From adb4fab09a19781666af53dd2cf92d711cb7925d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 15 Sep 2023 00:57:54 +0000 Subject: [PATCH 1/2] feat: add optional parameters (tarball_gcs_dir, diagnosis_interval, jobs, yarn_application_ids) in DiagnoseClusterRequest PiperOrigin-RevId: 565501215 Source-Link: https://github.com/googleapis/googleapis/commit/6b95655b943b06f3192e5079899d525485eff9ce Source-Link: https://github.com/googleapis/googleapis-gen/commit/caf4b28f7522ef21bcc006bcb8c9b6cd6d2231c4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRhdGFwcm9jLy5Pd2xCb3QueWFtbCIsImgiOiJjYWY0YjI4Zjc1MjJlZjIxYmNjMDA2YmNiOGM5YjZjZDZkMjIzMWM0In0= --- .../google-cloud-dataproc/v1/.eslintignore | 7 + .../google-cloud-dataproc/v1/.eslintrc.json | 3 + .../google-cloud-dataproc/v1/.gitignore | 14 + .../google-cloud-dataproc/v1/.jsdoc.js | 55 + .../google-cloud-dataproc/v1/.mocharc.js | 33 + .../google-cloud-dataproc/v1/.prettierrc.js | 22 + .../google-cloud-dataproc/v1/README.md | 1 + .../google-cloud-dataproc/v1/package.json | 63 + .../dataproc/v1/autoscaling_policies.proto | 381 +++ .../google/cloud/dataproc/v1/batches.proto | 403 +++ .../google/cloud/dataproc/v1/clusters.proto | 1588 +++++++++++ .../google/cloud/dataproc/v1/jobs.proto | 993 +++++++ .../cloud/dataproc/v1/node_groups.proto | 174 ++ .../google/cloud/dataproc/v1/operations.proto | 170 ++ .../google/cloud/dataproc/v1/shared.proto | 476 ++++ .../dataproc/v1/workflow_templates.proto | 836 ++++++ ...olicy_service.create_autoscaling_policy.js | 73 + ...olicy_service.delete_autoscaling_policy.js | 68 + ...g_policy_service.get_autoscaling_policy.js | 68 + ...olicy_service.list_autoscaling_policies.js | 80 + ...olicy_service.update_autoscaling_policy.js | 61 + .../v1/batch_controller.create_batch.js | 86 + .../v1/batch_controller.delete_batch.js | 63 + .../v1/batch_controller.get_batch.js | 63 + .../v1/batch_controller.list_batches.js | 93 + .../v1/cluster_controller.create_cluster.js | 90 + .../v1/cluster_controller.delete_cluster.js | 91 + .../v1/cluster_controller.diagnose_cluster.js | 94 + .../v1/cluster_controller.get_cluster.js | 72 + .../v1/cluster_controller.list_clusters.js | 95 + .../v1/cluster_controller.start_cluster.js | 91 + .../v1/cluster_controller.stop_cluster.js | 91 + .../v1/cluster_controller.update_cluster.js | 154 + .../generated/v1/job_controller.cancel_job.js | 72 + .../generated/v1/job_controller.delete_job.js | 72 + .../generated/v1/job_controller.get_job.js | 72 + .../generated/v1/job_controller.list_jobs.js | 102 + .../generated/v1/job_controller.submit_job.js | 85 + .../job_controller.submit_job_as_operation.js | 86 + .../generated/v1/job_controller.update_job.js | 87 + ...node_group_controller.create_node_group.js | 88 + .../node_group_controller.get_node_group.js | 63 + ...node_group_controller.resize_node_group.js | 98 + ...pet_metadata_google.cloud.dataproc.v1.json | 1703 +++++++++++ ...mplate_service.create_workflow_template.js | 73 + ...mplate_service.delete_workflow_template.js | 74 + ..._template_service.get_workflow_template.js | 74 + ...ce.instantiate_inline_workflow_template.js | 84 + ...e_service.instantiate_workflow_template.js | 92 + ...emplate_service.list_workflow_templates.js | 79 + ...mplate_service.update_workflow_template.js | 62 + .../google-cloud-dataproc/v1/src/index.ts | 35 + .../v1/autoscaling_policy_service_client.ts | 1374 +++++++++ ...oscaling_policy_service_client_config.json | 51 + ...autoscaling_policy_service_proto_list.json | 10 + .../v1/src/v1/batch_controller_client.ts | 1560 ++++++++++ .../v1/batch_controller_client_config.json | 42 + .../src/v1/batch_controller_proto_list.json | 10 + .../v1/src/v1/cluster_controller_client.ts | 2157 ++++++++++++++ .../v1/cluster_controller_client_config.json | 72 + .../src/v1/cluster_controller_proto_list.json | 10 + .../v1/src/v1/gapic_metadata.json | 453 +++ .../google-cloud-dataproc/v1/src/v1/index.ts | 24 + .../v1/src/v1/job_controller_client.ts | 1775 ++++++++++++ .../src/v1/job_controller_client_config.json | 69 + .../v1/src/v1/job_controller_proto_list.json | 10 + .../v1/src/v1/node_group_controller_client.ts | 1428 ++++++++++ .../node_group_controller_client_config.json | 38 + .../v1/node_group_controller_proto_list.json | 10 + .../v1/workflow_template_service_client.ts | 1871 ++++++++++++ ...rkflow_template_service_client_config.json | 69 + .../workflow_template_service_proto_list.json | 10 + .../system-test/fixtures/sample/src/index.js | 32 + .../system-test/fixtures/sample/src/index.ts | 62 + .../v1/system-test/install.ts | 49 + .../gapic_autoscaling_policy_service_v1.ts | 1509 ++++++++++ .../v1/test/gapic_batch_controller_v1.ts | 1714 +++++++++++ .../v1/test/gapic_cluster_controller_v1.ts | 2531 +++++++++++++++++ .../v1/test/gapic_job_controller_v1.ts | 2111 ++++++++++++++ .../v1/test/gapic_node_group_controller_v1.ts | 1534 ++++++++++ .../gapic_workflow_template_service_v1.ts | 2088 ++++++++++++++ .../google-cloud-dataproc/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + 83 files changed, 32509 insertions(+) create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/README.md create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/package.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-dataproc/v1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.eslintignore b/owl-bot-staging/google-cloud-dataproc/v1/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json b/owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json new file mode 100644 index 000000000000..782153495464 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.gitignore b/owl-bot-staging/google-cloud-dataproc/v1/.gitignore new file mode 100644 index 000000000000..d4f03a0df2e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/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-dataproc/v1/.jsdoc.js b/owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js new file mode 100644 index 000000000000..725b542ad92f --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dataproc', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js b/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js new file mode 100644 index 000000000000..1a38f257db70 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js b/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js new file mode 100644 index 000000000000..55639e70f9ea --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/README.md b/owl-bot-staging/google-cloud-dataproc/v1/README.md new file mode 100644 index 000000000000..3e8aa9dfae5f --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/README.md @@ -0,0 +1 @@ +Dataproc: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dataproc/v1/package.json b/owl-bot-staging/google-cloud-dataproc/v1/package.json new file mode 100644 index 000000000000..058457b6724d --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/package.json @@ -0,0 +1,63 @@ +{ + "name": "@google-cloud/dataproc", + "version": "0.1.0", + "description": "Dataproc client for Node.js", + "repository": "googleapis/nodejs-dataproc", + "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 dataproc", + "dataproc", + "autoscaling policy service", + "batch controller", + "cluster controller", + "job controller", + "node group controller", + "workflow template service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "^4.0.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.16", + "c8": "^8.0.1", + "gapic-tools": "^0.1.8", + "gts": "5.0.1", + "jsdoc": "^4.0.2", + "jsdoc-region-tag": "^3.0.0", + "jsdoc-fresh": "^3.0.0", + "mocha": "^10.2.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.2.0", + "typescript": "5.1.6" + }, + "engines": { + "node": ">=v14" + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto new file mode 100644 index 000000000000..123cd73e24e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto @@ -0,0 +1,381 @@ +// 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.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "AutoscalingPoliciesProto"; +option java_package = "com.google.cloud.dataproc.v1"; +option (google.api.resource_definition) = { + type: "dataproc.googleapis.com/Region" + pattern: "projects/{project}/regions/{region}" +}; + +// The API interface for managing autoscaling policies in the +// Dataproc API. +service AutoscalingPolicyService { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates new autoscaling policy. + rpc CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest) + returns (AutoscalingPolicy) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/autoscalingPolicies" + body: "policy" + additional_bindings { + post: "/v1/{parent=projects/*/regions/*}/autoscalingPolicies" + body: "policy" + } + }; + option (google.api.method_signature) = "parent,policy"; + } + + // Updates (replaces) autoscaling policy. + // + // Disabled check for update_mask, because all updates will be full + // replacements. + rpc UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest) + returns (AutoscalingPolicy) { + option (google.api.http) = { + put: "/v1/{policy.name=projects/*/locations/*/autoscalingPolicies/*}" + body: "policy" + additional_bindings { + put: "/v1/{policy.name=projects/*/regions/*/autoscalingPolicies/*}" + body: "policy" + } + }; + option (google.api.method_signature) = "policy"; + } + + // Retrieves autoscaling policy. + rpc GetAutoscalingPolicy(GetAutoscalingPolicyRequest) + returns (AutoscalingPolicy) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/autoscalingPolicies/*}" + additional_bindings { + get: "/v1/{name=projects/*/regions/*/autoscalingPolicies/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists autoscaling policies in the project. + rpc ListAutoscalingPolicies(ListAutoscalingPoliciesRequest) + returns (ListAutoscalingPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/autoscalingPolicies" + additional_bindings { + get: "/v1/{parent=projects/*/regions/*}/autoscalingPolicies" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes an autoscaling policy. It is an error to delete an autoscaling + // policy that is in use by one or more clusters. + rpc DeleteAutoscalingPolicy(DeleteAutoscalingPolicyRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/autoscalingPolicies/*}" + additional_bindings { + delete: "/v1/{name=projects/*/regions/*/autoscalingPolicies/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Describes an autoscaling policy for Dataproc cluster autoscaler. +message AutoscalingPolicy { + option (google.api.resource) = { + type: "dataproc.googleapis.com/AutoscalingPolicy" + pattern: "projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}" + pattern: "projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}" + }; + + // Required. The policy id. + // + // The id must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). Cannot begin or end with underscore + // or hyphen. Must consist of between 3 and 50 characters. + // + string id = 1; + + // Output only. The "resource name" of the autoscaling policy, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.autoscalingPolicies`, the resource name of the + // policy has the following format: + // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + // + // * For `projects.locations.autoscalingPolicies`, the resource name of the + // policy has the following format: + // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + string name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Autoscaling algorithm for policy. + oneof algorithm { + BasicAutoscalingAlgorithm basic_algorithm = 3 + [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Describes how the autoscaler will operate for primary workers. + InstanceGroupAutoscalingPolicyConfig worker_config = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Describes how the autoscaler will operate for secondary workers. + InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels to associate with this autoscaling policy. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with an autoscaling policy. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Basic algorithm for autoscaling. +message BasicAutoscalingAlgorithm { + oneof config { + // Required. YARN autoscaling configuration. + BasicYarnAutoscalingConfig yarn_config = 1 + [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. Duration between scaling events. A scaling period starts after + // the update operation from the previous event has completed. + // + // Bounds: [2m, 1d]. Default: 2m. + google.protobuf.Duration cooldown_period = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Basic autoscaling configurations for YARN. +message BasicYarnAutoscalingConfig { + // Required. Timeout for YARN graceful decommissioning of Node Managers. + // Specifies the duration to wait for jobs to complete before forcefully + // removing workers (and potentially interrupting jobs). Only applicable to + // downscaling operations. + // + // Bounds: [0s, 1d]. + google.protobuf.Duration graceful_decommission_timeout = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Fraction of average YARN pending memory in the last cooldown + // period for which to add workers. A scale-up factor of 1.0 will result in + // scaling up so that there is no pending memory remaining after the update + // (more aggressive scaling). A scale-up factor closer to 0 will result in a + // smaller magnitude of scaling up (less aggressive scaling). See [How + // autoscaling + // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) + // for more information. + // + // Bounds: [0.0, 1.0]. + double scale_up_factor = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Fraction of average YARN pending memory in the last cooldown + // period for which to remove workers. A scale-down factor of 1 will result in + // scaling down so that there is no available memory remaining after the + // update (more aggressive scaling). A scale-down factor of 0 disables + // removing workers, which can be beneficial for autoscaling a single job. + // See [How autoscaling + // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) + // for more information. + // + // Bounds: [0.0, 1.0]. + double scale_down_factor = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Minimum scale-up threshold as a fraction of total cluster size + // before scaling occurs. For example, in a 20-worker cluster, a threshold of + // 0.1 means the autoscaler must recommend at least a 2-worker scale-up for + // the cluster to scale. A threshold of 0 means the autoscaler will scale up + // on any recommended change. + // + // Bounds: [0.0, 1.0]. Default: 0.0. + double scale_up_min_worker_fraction = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Minimum scale-down threshold as a fraction of total cluster size + // before scaling occurs. For example, in a 20-worker cluster, a threshold of + // 0.1 means the autoscaler must recommend at least a 2 worker scale-down for + // the cluster to scale. A threshold of 0 means the autoscaler will scale down + // on any recommended change. + // + // Bounds: [0.0, 1.0]. Default: 0.0. + double scale_down_min_worker_fraction = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for the size bounds of an instance group, including its +// proportional size to other groups. +message InstanceGroupAutoscalingPolicyConfig { + // Optional. Minimum number of instances for this group. + // + // Primary workers - Bounds: [2, max_instances]. Default: 2. + // Secondary workers - Bounds: [0, max_instances]. Default: 0. + int32 min_instances = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Maximum number of instances for this group. Required for primary + // workers. Note that by default, clusters will not use secondary workers. + // Required for secondary workers if the minimum secondary instances is set. + // + // Primary workers - Bounds: [min_instances, ). + // Secondary workers - Bounds: [min_instances, ). Default: 0. + int32 max_instances = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Weight for the instance group, which is used to determine the + // fraction of total workers in the cluster from this instance group. + // For example, if primary workers have weight 2, and secondary workers have + // weight 1, the cluster will have approximately 2 primary workers for each + // secondary worker. + // + // The cluster may not reach the specified balance if constrained + // by min/max bounds or other autoscaling settings. For example, if + // `max_instances` for secondary workers is 0, then only primary workers will + // be added. The cluster can also be out of balance when created. + // + // If weight is not set on any instance group, the cluster will default to + // equal weight for all groups: the cluster will attempt to maintain an equal + // number of workers in each group within the configured size bounds for each + // group. If weight is set for one group only, the cluster will default to + // zero weight on the unset group. For example if weight is set only on + // primary workers, the cluster will use primary workers only and no + // secondary workers. + int32 weight = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to create an autoscaling policy. +message CreateAutoscalingPolicyRequest { + // Required. The "resource name" of the region or location, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.autoscalingPolicies.create`, the resource name + // of the region has the following format: + // `projects/{project_id}/regions/{region}` + // + // * For `projects.locations.autoscalingPolicies.create`, the resource name + // of the location has the following format: + // `projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/AutoscalingPolicy" + } + ]; + + // Required. The autoscaling policy to create. + AutoscalingPolicy policy = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to fetch an autoscaling policy. +message GetAutoscalingPolicyRequest { + // Required. The "resource name" of the autoscaling policy, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.autoscalingPolicies.get`, the resource name + // of the policy has the following format: + // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + // + // * For `projects.locations.autoscalingPolicies.get`, the resource name + // of the policy has the following format: + // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/AutoscalingPolicy" + } + ]; +} + +// A request to update an autoscaling policy. +message UpdateAutoscalingPolicyRequest { + // Required. The updated autoscaling policy. + AutoscalingPolicy policy = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to delete an autoscaling policy. +// +// Autoscaling policies in use by one or more clusters will not be deleted. +message DeleteAutoscalingPolicyRequest { + // Required. The "resource name" of the autoscaling policy, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.autoscalingPolicies.delete`, the resource name + // of the policy has the following format: + // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + // + // * For `projects.locations.autoscalingPolicies.delete`, the resource name + // of the policy has the following format: + // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/AutoscalingPolicy" + } + ]; +} + +// A request to list autoscaling policies in a project. +message ListAutoscalingPoliciesRequest { + // Required. The "resource name" of the region or location, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.autoscalingPolicies.list`, the resource name + // of the region has the following format: + // `projects/{project_id}/regions/{region}` + // + // * For `projects.locations.autoscalingPolicies.list`, the resource name + // of the location has the following format: + // `projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/AutoscalingPolicy" + } + ]; + + // Optional. The maximum number of results to return in each response. + // Must be less than or equal to 1000. Defaults to 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page token, returned by a previous call, to request the + // next page of results. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A response to a request to list autoscaling policies in a project. +message ListAutoscalingPoliciesResponse { + // Output only. Autoscaling policies list. + repeated AutoscalingPolicy policies = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This token is included in the response if there are more + // results to fetch. + string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto new file mode 100644 index 000000000000..56d73f5c8843 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto @@ -0,0 +1,403 @@ +// 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.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/shared.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "BatchesProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The BatchController provides methods to manage batch workloads. +service BatchController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a batch workload that executes asynchronously. + rpc CreateBatch(CreateBatchRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/batches" + body: "batch" + }; + option (google.api.method_signature) = "parent,batch,batch_id"; + option (google.longrunning.operation_info) = { + response_type: "Batch" + metadata_type: "google.cloud.dataproc.v1.BatchOperationMetadata" + }; + } + + // Gets the batch workload resource representation. + rpc GetBatch(GetBatchRequest) returns (Batch) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/batches/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists batch workloads. + rpc ListBatches(ListBatchesRequest) returns (ListBatchesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/batches" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the batch workload resource. If the batch is not in terminal state, + // the delete fails and the response returns `FAILED_PRECONDITION`. + rpc DeleteBatch(DeleteBatchRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/batches/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// A request to create a batch workload. +message CreateBatchRequest { + // Required. The parent resource where this batch will be created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/Batch" + } + ]; + + // Required. The batch to create. + Batch batch = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the batch, which will become the final + // component of the batch's resource name. + // + // This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`. + string batch_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique ID used to identify the request. If the service + // receives two + // [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s + // with the same request_id, the second request is ignored and the + // Operation that corresponds to the first Batch created and stored + // in the backend is returned. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The value must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get the resource representation for a batch workload. +message GetBatchRequest { + // Required. The fully qualified name of the batch to retrieve + // in the format + // "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "dataproc.googleapis.com/Batch" } + ]; +} + +// A request to list batch workloads in a project. +message ListBatchesRequest { + // Required. The parent, which owns this collection of batches. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/Batch" + } + ]; + + // Optional. The maximum number of batches to return in each response. + // The service may return fewer than this value. + // The default page size is 20; the maximum page size is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token received from a previous `ListBatches` call. + // Provide this token to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter for the batches to return in the response. + // + // A filter is a logical expression constraining the values of various fields + // in each batch resource. Filters are case sensitive, and may contain + // multiple clauses combined with logical operators (AND/OR). + // Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. + // + // e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` + // filters for batches in state RUNNING that were created before 2023-01-01 + // + // See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + // description of the filter syntax and a list of supported comparisons. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Field(s) on which to sort the list of batches. + // + // Currently the only supported sort orders are unspecified (empty) and + // `create_time desc` to sort by most recently created batches first. + // + // See https://google.aip.dev/132#ordering for more details. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// A list of batch workloads. +message ListBatchesResponse { + // The batches from the specified collection. + repeated Batch batches = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// A request to delete a batch workload. +message DeleteBatchRequest { + // Required. The fully qualified name of the batch to retrieve + // in the format + // "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "dataproc.googleapis.com/Batch" } + ]; +} + +// A representation of a batch workload in the service. +message Batch { + option (google.api.resource) = { + type: "dataproc.googleapis.com/Batch" + pattern: "projects/{project}/locations/{location}/batches/{batch}" + }; + + // The batch state. + enum State { + // The batch state is unknown. + STATE_UNSPECIFIED = 0; + + // The batch is created before running. + PENDING = 1; + + // The batch is running. + RUNNING = 2; + + // The batch is cancelling. + CANCELLING = 3; + + // The batch cancellation was successful. + CANCELLED = 4; + + // The batch completed successfully. + SUCCEEDED = 5; + + // The batch is no longer running due to an error. + FAILED = 6; + } + + // Historical state information. + message StateHistory { + // Output only. The state of the batch at this point in history. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Details about the state at this point in history. + string state_message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the batch entered the historical state. + google.protobuf.Timestamp state_start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The resource name of the batch. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A batch UUID (Unique Universal Identifier). The service + // generates this value when it creates the batch. + string uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the batch was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The application/framework-specific portion of the batch configuration. + oneof batch_config { + // Optional. PySpark batch config. + PySparkBatch pyspark_batch = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Spark batch config. + SparkBatch spark_batch = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. SparkR batch config. + SparkRBatch spark_r_batch = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. SparkSql batch config. + SparkSqlBatch spark_sql_batch = 7 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. Runtime information about batch execution. + RuntimeInfo runtime_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the batch. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Batch state details, such as a failure + // description if the state is `FAILED`. + string state_message = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the batch entered a current state. + google.protobuf.Timestamp state_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The email address of the user who created the batch. + string creator = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The labels to associate with this batch. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with a batch. + map labels = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Runtime configuration for the batch execution. + RuntimeConfig runtime_config = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Environment configuration for the batch execution. + EnvironmentConfig environment_config = 15 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The resource name of the operation associated with this batch. + string operation = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Historical state information for the batch. + repeated StateHistory state_history = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A configuration for running an +// [Apache +// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html) +// batch workload. +message PySparkBatch { + // Required. The HCFS URI of the main Python file to use as the Spark driver. + // Must be a .py file. + string main_python_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The arguments to pass to the driver. Do not include arguments + // that can be set as batch properties, such as `--conf`, since a collision + // can occur that causes an incorrect batch submission. + repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS file URIs of Python files to pass to the PySpark + // framework. Supported file types: `.py`, `.egg`, and `.zip`. + repeated string python_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the classpath of the + // Spark driver and tasks. + repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. + repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. + repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A configuration for running an [Apache Spark](https://spark.apache.org/) +// batch workload. +message SparkBatch { + // The specification of the main method to call to drive the Spark + // workload. Specify either the jar file that contains the main class or the + // main class name. To pass both a main jar and a main class in that jar, add + // the jar to `jar_file_uris`, and then specify the main class + // name in `main_class`. + oneof driver { + // Optional. The HCFS URI of the jar file that contains the main class. + string main_jar_file_uri = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the driver main class. The jar file that contains + // the class must be in the classpath or specified in `jar_file_uris`. + string main_class = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The arguments to pass to the driver. Do not include arguments + // that can be set as batch properties, such as `--conf`, since a collision + // can occur that causes an incorrect batch submission. + repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the classpath of the + // Spark driver and tasks. + repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. + repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. + repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A configuration for running an +// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html) +// batch workload. +message SparkRBatch { + // Required. The HCFS URI of the main R file to use as the driver. + // Must be a `.R` or `.r` file. + string main_r_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The arguments to pass to the Spark driver. Do not include + // arguments that can be set as batch properties, such as `--conf`, since a + // collision can occur that causes an incorrect batch submission. + repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. + repeated string file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. + repeated string archive_uris = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A configuration for running +// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch +// workload. +message SparkSqlBatch { + // Required. The HCFS URI of the script that contains Spark SQL queries to + // execute. + string query_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Mapping of query variable names to values (equivalent to the + // Spark SQL command: `SET name="value";`). + map query_variables = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. + repeated string jar_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto new file mode 100644 index 000000000000..03a4e8d60061 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto @@ -0,0 +1,1588 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/shared.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/interval.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "ClustersProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The ClusterControllerService provides methods to manage clusters +// of Compute Engine instances. +service ClusterController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a cluster in a project. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] will be + // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + rpc CreateCluster(CreateClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/clusters" + body: "cluster" + }; + option (google.api.method_signature) = "project_id,region,cluster"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } + + // Updates a cluster in a project. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] will be + // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + // The cluster must be in a + // [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error + // is returned. + rpc UpdateCluster(UpdateClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" + body: "cluster" + }; + option (google.api.method_signature) = + "project_id,region,cluster_name,cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } + + // Stops a cluster in a project. + rpc StopCluster(StopClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } + + // Starts a cluster in a project. + rpc StartCluster(StartClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } + + // Deletes a cluster in a project. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] will be + // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + rpc DeleteCluster(DeleteClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" + }; + option (google.api.method_signature) = "project_id,region,cluster_name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } + + // Gets the resource representation for a cluster in a project. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" + }; + option (google.api.method_signature) = "project_id,region,cluster_name"; + } + + // Lists all regions/{region}/clusters in a project alphabetically. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/regions/{region}/clusters" + }; + option (google.api.method_signature) = "project_id,region"; + option (google.api.method_signature) = "project_id,region,filter"; + } + + // Gets cluster diagnostic information. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] will be + // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + // After the operation completes, + // [Operation.response][google.longrunning.Operation.response] + // contains + // [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). + rpc DiagnoseCluster(DiagnoseClusterRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:diagnose" + body: "*" + }; + option (google.api.method_signature) = "project_id,region,cluster_name"; + option (google.longrunning.operation_info) = { + response_type: "DiagnoseClusterResults" + metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" + }; + } +} + +// Describes the identifying information, config, and status of +// a Dataproc cluster +message Cluster { + // Required. The Google Cloud Platform project ID that the cluster belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name, which must be unique within a project. + // The name must start with a lowercase letter, and can contain + // up to 51 lowercase letters, numbers, and hyphens. It cannot end + // with a hyphen. The name of a deleted cluster can be reused. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The cluster config for a cluster of Compute Engine Instances. + // Note that Dataproc may set default values, and values may change + // when clusters are updated. + // + // Exactly one of ClusterConfig or VirtualClusterConfig must be specified. + ClusterConfig config = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The virtual cluster config is used when creating a Dataproc + // cluster that does not directly control the underlying compute resources, + // for example, when creating a [Dataproc-on-GKE + // cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). + // Dataproc may set default values, and values may change when + // clusters are updated. Exactly one of + // [config][google.cloud.dataproc.v1.Cluster.config] or + // [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] + // must be specified. + VirtualClusterConfig virtual_cluster_config = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels to associate with this cluster. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with a cluster. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Cluster status. + ClusterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The previous cluster status. + repeated ClusterStatus status_history = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A cluster UUID (Unique Universal Identifier). Dataproc + // generates this value when it creates the cluster. + string cluster_uuid = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Contains cluster daemon metrics such as HDFS and YARN stats. + // + // **Beta Feature**: This report is available for testing purposes only. It + // may be changed before final release. + ClusterMetrics metrics = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The cluster config. +message ClusterConfig { + // Optional. A Cloud Storage bucket used to stage job + // dependencies, config files, and job driver console output. + // If you do not specify a staging bucket, Cloud + // Dataproc will determine a Cloud Storage location (US, + // ASIA, or EU) for your cluster's staging bucket according to the + // Compute Engine zone where your cluster is deployed, and then create + // and manage this project-level, per-location bucket (see + // [Dataproc staging and temp + // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). + // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to + // a Cloud Storage bucket.** + string config_bucket = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs + // data, such as Spark and MapReduce history files. If you do not specify a + // temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or + // EU) for your cluster's temp bucket according to the Compute Engine zone + // where your cluster is deployed, and then create and manage this + // project-level, per-location bucket. The default bucket has a TTL of 90 + // days, but you can use any TTL (or none) if you specify a bucket (see + // [Dataproc staging and temp + // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). + // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to + // a Cloud Storage bucket.** + string temp_bucket = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The shared Compute Engine config settings for + // all instances in a cluster. + GceClusterConfig gce_cluster_config = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine config settings for + // the cluster's master instance. + InstanceGroupConfig master_config = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine config settings for + // the cluster's worker instances. + InstanceGroupConfig worker_config = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine config settings for + // a cluster's secondary worker instances + InstanceGroupConfig secondary_worker_config = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The config settings for cluster software. + SoftwareConfig software_config = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Commands to execute on each node after config is + // completed. By default, executables are run on master and all worker nodes. + // You can test a node's `role` metadata to run an executable on + // a master or worker node, as shown below using `curl` (you can also use + // `wget`): + // + // ROLE=$(curl -H Metadata-Flavor:Google + // http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) + // if [[ "${ROLE}" == 'Master' ]]; then + // ... master specific actions ... + // else + // ... worker specific actions ... + // fi + repeated NodeInitializationAction initialization_actions = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Encryption settings for the cluster. + EncryptionConfig encryption_config = 15 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Autoscaling config for the policy associated with the cluster. + // Cluster does not autoscale if this field is unset. + AutoscalingConfig autoscaling_config = 18 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Security settings for the cluster. + SecurityConfig security_config = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lifecycle setting for the cluster. + LifecycleConfig lifecycle_config = 17 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Port/endpoint configuration for this cluster + EndpointConfig endpoint_config = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Metastore configuration. + MetastoreConfig metastore_config = 20 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The config for Dataproc metrics. + DataprocMetricConfig dataproc_metric_config = 23 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The node group settings. + repeated AuxiliaryNodeGroup auxiliary_node_groups = 25 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The Dataproc cluster config for a cluster that does not directly control the +// underlying compute resources, such as a [Dataproc-on-GKE +// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). +message VirtualClusterConfig { + // Optional. A Cloud Storage bucket used to stage job + // dependencies, config files, and job driver console output. + // If you do not specify a staging bucket, Cloud + // Dataproc will determine a Cloud Storage location (US, + // ASIA, or EU) for your cluster's staging bucket according to the + // Compute Engine zone where your cluster is deployed, and then create + // and manage this project-level, per-location bucket (see + // [Dataproc staging and temp + // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). + // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to + // a Cloud Storage bucket.** + string staging_bucket = 1 [(google.api.field_behavior) = OPTIONAL]; + + oneof infrastructure_config { + // Required. The configuration for running the Dataproc cluster on + // Kubernetes. + KubernetesClusterConfig kubernetes_cluster_config = 6 + [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. Configuration of auxiliary services used by this cluster. + AuxiliaryServicesConfig auxiliary_services_config = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Auxiliary services configuration for a Cluster. +message AuxiliaryServicesConfig { + // Optional. The Hive Metastore configuration for this workload. + MetastoreConfig metastore_config = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Spark History Server configuration for the workload. + SparkHistoryServerConfig spark_history_server_config = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Endpoint config for this cluster +message EndpointConfig { + // Output only. The map of port descriptions to URLs. Will only be populated + // if enable_http_port_access is true. + map http_ports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If true, enable http access to specific ports on the cluster + // from external sources. Defaults to false. + bool enable_http_port_access = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Autoscaling Policy config associated with the cluster. +message AutoscalingConfig { + // Optional. The autoscaling policy used by the cluster. + // + // Only resource names including projectid and location (region) are valid. + // Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]` + // * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]` + // + // Note that the policy must be in the same project and Dataproc region. + string policy_uri = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Encryption settings for the cluster. +message EncryptionConfig { + // Optional. The Cloud KMS key name to use for PD disk encryption for all + // instances in the cluster. + string gce_pd_kms_key_name = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Common config settings for resources of Compute Engine cluster +// instances, applicable to all instances in the cluster. +message GceClusterConfig { + // `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes + // can communicate with Google Services through gRPC over IPv6. + // These values are directly mapped to corresponding values in the + // [Compute Engine Instance + // fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances). + enum PrivateIpv6GoogleAccess { + // If unspecified, Compute Engine default behavior will apply, which + // is the same as + // [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]. + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; + + // Private access to and from Google Services configuration + // inherited from the subnetwork configuration. This is the + // default Compute Engine behavior. + INHERIT_FROM_SUBNETWORK = 1; + + // Enables outbound private IPv6 access to Google Services from the Dataproc + // cluster. + OUTBOUND = 2; + + // Enables bidirectional private IPv6 access between Google Services and the + // Dataproc cluster. + BIDIRECTIONAL = 3; + } + + // Optional. The Compute Engine zone where the Dataproc cluster will be + // located. If omitted, the service will pick a zone in the cluster's Compute + // Engine region. On a get request, zone will always be present. + // + // A full URL, partial URI, or short name are valid. Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]` + // * `projects/[project_id]/zones/[zone]` + // * `[zone]` + string zone_uri = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine network to be used for machine + // communications. Cannot be specified with subnetwork_uri. If neither + // `network_uri` nor `subnetwork_uri` is specified, the "default" network of + // the project is used, if it exists. Cannot be a "Custom Subnet Network" (see + // [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for + // more information). + // + // A full URL, partial URI, or short name are valid. Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/networks/default` + // * `projects/[project_id]/global/networks/default` + // * `default` + string network_uri = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine subnetwork to be used for machine + // communications. Cannot be specified with network_uri. + // + // A full URL, partial URI, or short name are valid. Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/[region]/subnetworks/sub0` + // * `projects/[project_id]/regions/[region]/subnetworks/sub0` + // * `sub0` + string subnetwork_uri = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, all instances in the cluster will only have internal IP + // addresses. By default, clusters are not restricted to internal IP + // addresses, and will have ephemeral external IP addresses assigned to each + // instance. This `internal_ip_only` restriction can only be enabled for + // subnetwork enabled networks, and all off-cluster dependencies must be + // configured to be accessible without external IP addresses. + optional bool internal_ip_only = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of IPv6 access for a cluster. + PrivateIpv6GoogleAccess private_ipv6_google_access = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [Dataproc service + // account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc) + // (also see [VM Data Plane + // identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity)) + // used by Dataproc cluster VM instances to access Google Cloud Platform + // services. + // + // If not specified, the + // [Compute Engine default service + // account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) + // is used. + string service_account = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The URIs of service account scopes to be included in + // Compute Engine instances. The following base set of scopes is always + // included: + // + // * https://www.googleapis.com/auth/cloud.useraccounts.readonly + // * https://www.googleapis.com/auth/devstorage.read_write + // * https://www.googleapis.com/auth/logging.write + // + // If no scopes are specified, the following defaults are also provided: + // + // * https://www.googleapis.com/auth/bigquery + // * https://www.googleapis.com/auth/bigtable.admin.table + // * https://www.googleapis.com/auth/bigtable.data + // * https://www.googleapis.com/auth/devstorage.full_control + repeated string service_account_scopes = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // The Compute Engine tags to add to all instances (see [Tagging + // instances](https://cloud.google.com/compute/docs/label-or-tag-resources#tags)). + repeated string tags = 4; + + // Optional. The Compute Engine metadata entries to add to all instances (see + // [Project and instance + // metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)). + map metadata = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Reservation Affinity for consuming Zonal reservation. + ReservationAffinity reservation_affinity = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Node Group Affinity for sole-tenant clusters. + NodeGroupAffinity node_group_affinity = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Shielded Instance Config for clusters using [Compute Engine + // Shielded + // VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). + ShieldedInstanceConfig shielded_instance_config = 14 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Confidential Instance Config for clusters using [Confidential + // VMs](https://cloud.google.com/compute/confidential-vm/docs). + ConfidentialInstanceConfig confidential_instance_config = 15 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Node Group Affinity for clusters using sole-tenant node groups. +// **The Dataproc `NodeGroupAffinity` resource is not related to the +// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.** +message NodeGroupAffinity { + // Required. The URI of a + // sole-tenant [node group + // resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups) + // that the cluster will be created on. + // + // A full URL, partial URI, or node group name are valid. Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/nodeGroups/node-group-1` + // * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1` + // * `node-group-1` + string node_group_uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Shielded Instance Config for clusters using [Compute Engine Shielded +// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). +message ShieldedInstanceConfig { + // Optional. Defines whether instances have Secure Boot enabled. + optional bool enable_secure_boot = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Defines whether instances have the vTPM enabled. + optional bool enable_vtpm = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Defines whether instances have integrity monitoring enabled. + optional bool enable_integrity_monitoring = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Confidential Instance Config for clusters using [Confidential +// VMs](https://cloud.google.com/compute/confidential-vm/docs) +message ConfidentialInstanceConfig { + // Optional. Defines whether the instance should have confidential compute + // enabled. + bool enable_confidential_compute = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// The config settings for Compute Engine resources in +// an instance group, such as a master or worker group. +message InstanceGroupConfig { + // Controls the use of preemptible instances within the group. + enum Preemptibility { + // Preemptibility is unspecified, the system will choose the + // appropriate setting for each instance group. + PREEMPTIBILITY_UNSPECIFIED = 0; + + // Instances are non-preemptible. + // + // This option is allowed for all instance groups and is the only valid + // value for Master and Worker instance groups. + NON_PREEMPTIBLE = 1; + + // Instances are [preemptible] + // (https://cloud.google.com/compute/docs/instances/preemptible). + // + // This option is allowed only for [secondary worker] + // (https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms) + // groups. + PREEMPTIBLE = 2; + + // Instances are [Spot VMs] + // (https://cloud.google.com/compute/docs/instances/spot). + // + // This option is allowed only for [secondary worker] + // (https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms) + // groups. Spot VMs are the latest version of [preemptible VMs] + // (https://cloud.google.com/compute/docs/instances/preemptible), and + // provide additional features. + SPOT = 3; + } + + // Optional. The number of VM instances in the instance group. + // For [HA + // cluster](/dataproc/docs/concepts/configuring-clusters/high-availability) + // [master_config](#FIELDS.master_config) groups, **must be set to 3**. + // For standard cluster [master_config](#FIELDS.master_config) groups, + // **must be set to 1**. + int32 num_instances = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The list of instance names. Dataproc derives the names + // from `cluster_name`, `num_instances`, and the instance group. + repeated string instance_names = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List of references to Compute Engine instances. + repeated InstanceReference instance_references = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The Compute Engine image resource used for cluster instances. + // + // The URI can represent an image or image family. + // + // Image examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/[image-id]` + // * `projects/[project_id]/global/images/[image-id]` + // * `image-id` + // + // Image family examples. Dataproc will use the most recent + // image from the family: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/family/[custom-image-family-name]` + // * `projects/[project_id]/global/images/family/[custom-image-family-name]` + // + // If the URI is unspecified, it will be inferred from + // `SoftwareConfig.image_version` or the system default. + string image_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Compute Engine machine type used for cluster instances. + // + // A full URL, partial URI, or short name are valid. Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2` + // * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2` + // * `n1-standard-2` + // + // **Auto Zone Exception**: If you are using the Dataproc + // [Auto Zone + // Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) + // feature, you must use the short name of the machine type + // resource, for example, `n1-standard-2`. + string machine_type_uri = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Disk option config settings. + DiskConfig disk_config = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Specifies that this instance group contains preemptible + // instances. + bool is_preemptible = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Specifies the preemptibility of the instance group. + // + // The default value for master and worker groups is + // `NON_PREEMPTIBLE`. This default cannot be changed. + // + // The default value for secondary instances is + // `PREEMPTIBLE`. + Preemptibility preemptibility = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The config for Compute Engine Instance Group + // Manager that manages this group. + // This is only used for preemptible instance groups. + ManagedGroupConfig managed_group_config = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The Compute Engine accelerator configuration for these + // instances. + repeated AcceleratorConfig accelerators = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the minimum cpu platform for the Instance Group. + // See [Dataproc -> Minimum CPU + // Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu). + string min_cpu_platform = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The minimum number of primary worker instances to create. + // If `min_num_instances` is set, cluster creation will succeed if + // the number of primary workers created is at least equal to the + // `min_num_instances` number. + // + // Example: Cluster creation request with `num_instances` = `5` and + // `min_num_instances` = `3`: + // + // * If 4 VMs are created and 1 instance fails, + // the failed VM is deleted. The cluster is + // resized to 4 instances and placed in a `RUNNING` state. + // * If 2 instances are created and 3 instances fail, + // the cluster in placed in an `ERROR` state. The failed VMs + // are not deleted. + int32 min_num_instances = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Instance flexibility Policy allowing a mixture of VM shapes and + // provisioning models. + InstanceFlexibilityPolicy instance_flexibility_policy = 13 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A reference to a Compute Engine instance. +message InstanceReference { + // The user-friendly name of the Compute Engine instance. + string instance_name = 1; + + // The unique identifier of the Compute Engine instance. + string instance_id = 2; + + // The public RSA key used for sharing data with this instance. + string public_key = 3; + + // The public ECIES key used for sharing data with this instance. + string public_ecies_key = 4; +} + +// Specifies the resources used to actively manage an instance group. +message ManagedGroupConfig { + // Output only. The name of the Instance Template used for the Managed + // Instance Group. + string instance_template_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the Instance Group Manager for this group. + string instance_group_manager_name = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The partial URI to the instance group manager for this group. + // E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm. + string instance_group_manager_uri = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Instance flexibility Policy allowing a mixture of VM shapes and provisioning +// models. +message InstanceFlexibilityPolicy { + // Defines machines types and a rank to which the machines types belong. + message InstanceSelection { + // Optional. Full machine-type names, e.g. "n1-standard-16". + repeated string machine_types = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Preference of this instance selection. Lower number means + // higher preference. Dataproc will first try to create a VM based on the + // machine-type with priority rank and fallback to next rank based on + // availability. Machine types and instance selections with the same + // priority have the same preference. + int32 rank = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Defines a mapping from machine types to the number of VMs that are created + // with each machine type. + message InstanceSelectionResult { + // Output only. Full machine-type names, e.g. "n1-standard-16". + optional string machine_type = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of VM provisioned with the machine_type. + optional int32 vm_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Optional. List of instance selection options that the group will use when + // creating new VMs. + repeated InstanceSelection instance_selection_list = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A list of instance selection results in the group. + repeated InstanceSelectionResult instance_selection_results = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Specifies the type and number of accelerator cards attached to the instances +// of an instance. See [GPUs on Compute +// Engine](https://cloud.google.com/compute/docs/gpus/). +message AcceleratorConfig { + // Full URL, partial URI, or short name of the accelerator type resource to + // expose to this instance. See + // [Compute Engine + // AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes). + // + // Examples: + // + // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-k80` + // * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-k80` + // * `nvidia-tesla-k80` + // + // **Auto Zone Exception**: If you are using the Dataproc + // [Auto Zone + // Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) + // feature, you must use the short name of the accelerator type + // resource, for example, `nvidia-tesla-k80`. + string accelerator_type_uri = 1; + + // The number of the accelerator cards of this type exposed to this instance. + int32 accelerator_count = 2; +} + +// Specifies the config of disk options for a group of VM instances. +message DiskConfig { + // Optional. Type of the boot disk (default is "pd-standard"). + // Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive), + // "pd-ssd" (Persistent Disk Solid State Drive), + // or "pd-standard" (Persistent Disk Hard Disk Drive). + // See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types). + string boot_disk_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Size in GB of the boot disk (default is 500GB). + int32 boot_disk_size_gb = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Number of attached SSDs, from 0 to 8 (default is 0). + // If SSDs are not attached, the boot disk is used to store runtime logs and + // [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. + // If one or more SSDs are attached, this runtime bulk + // data is spread across them, and the boot disk contains only basic + // config and installed binaries. + // + // Note: Local SSD options may vary by machine type and number of vCPUs + // selected. + int32 num_local_ssds = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Interface type of local SSDs (default is "scsi"). + // Valid values: "scsi" (Small Computer System Interface), + // "nvme" (Non-Volatile Memory Express). + // See [local SSD + // performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance). + string local_ssd_interface = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Node group identification and configuration information. +message AuxiliaryNodeGroup { + // Required. Node group configuration. + NodeGroup node_group = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A node group ID. Generated if not specified. + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). Cannot begin or end with underscore + // or hyphen. Must consist of from 3 to 33 characters. + string node_group_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Dataproc Node Group. +// **The Dataproc `NodeGroup` resource is not related to the +// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity] +// resource.** +message NodeGroup { + option (google.api.resource) = { + type: "dataproc.googleapis.com/NodeGroup" + pattern: "projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}" + }; + + // Node pool roles. + enum Role { + // Required unspecified role. + ROLE_UNSPECIFIED = 0; + + // Job drivers run on the node pool. + DRIVER = 1; + } + + // The Node group [resource name](https://aip.dev/122). + string name = 1; + + // Required. Node group roles. + repeated Role roles = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The node group instance group configuration. + InstanceGroupConfig node_group_config = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Node group labels. + // + // * Label **keys** must consist of from 1 to 63 characters and conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // * Label **values** can be empty. If specified, they must consist of from + // 1 to 63 characters and conform to [RFC 1035] + // (https://www.ietf.org/rfc/rfc1035.txt). + // * The node group must have no more than 32 labels. + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Specifies an executable to run on a fully configured node and a +// timeout period for executable completion. +message NodeInitializationAction { + // Required. Cloud Storage URI of executable file. + string executable_file = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Amount of time executable has to complete. Default is + // 10 minutes (see JSON representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + // + // Cluster creation fails with an explanatory error message (the + // name of the executable that caused the error and the exceeded timeout + // period) if the executable is not completed at end of the timeout period. + google.protobuf.Duration execution_timeout = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The status of a cluster and its instances. +message ClusterStatus { + // The cluster state. + enum State { + // The cluster state is unknown. + UNKNOWN = 0; + + // The cluster is being created and set up. It is not ready for use. + CREATING = 1; + + // The cluster is currently running and healthy. It is ready for use. + // + // **Note:** The cluster state changes from "creating" to "running" status + // after the master node(s), first two primary worker nodes (and the last + // primary worker node if primary workers > 2) are running. + RUNNING = 2; + + // The cluster encountered an error. It is not ready for use. + ERROR = 3; + + // The cluster has encountered an error while being updated. Jobs can + // be submitted to the cluster, but the cluster cannot be updated. + ERROR_DUE_TO_UPDATE = 9; + + // The cluster is being deleted. It cannot be used. + DELETING = 4; + + // The cluster is being updated. It continues to accept and process jobs. + UPDATING = 5; + + // The cluster is being stopped. It cannot be used. + STOPPING = 6; + + // The cluster is currently stopped. It is not ready for use. + STOPPED = 7; + + // The cluster is being started. It is not ready for use. + STARTING = 8; + + // The cluster is being repaired. It is not ready for use. + REPAIRING = 10; + } + + // The cluster substate. + enum Substate { + // The cluster substate is unknown. + UNSPECIFIED = 0; + + // The cluster is known to be in an unhealthy state + // (for example, critical daemons are not running or HDFS capacity is + // exhausted). + // + // Applies to RUNNING state. + UNHEALTHY = 1; + + // The agent-reported status is out of date (may occur if + // Dataproc loses communication with Agent). + // + // Applies to RUNNING state. + STALE_STATUS = 2; + } + + // Output only. The cluster's state. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. Details of cluster's state. + string detail = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Output only. Time when this state was entered (see JSON representation of + // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Timestamp state_start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional state information that includes + // status reported by the agent. + Substate substate = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Security related configuration, including encryption, Kerberos, etc. +message SecurityConfig { + // Optional. Kerberos related configuration. + KerberosConfig kerberos_config = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Identity related configuration, including service account based + // secure multi-tenancy user mappings. + IdentityConfig identity_config = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Specifies Kerberos related configuration. +message KerberosConfig { + // Optional. Flag to indicate whether to Kerberize the cluster (default: + // false). Set this field to true to enable Kerberos on a cluster. + bool enable_kerberos = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the root + // principal password. + string root_principal_password_uri = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The uri of the KMS key used to encrypt various sensitive + // files. + string kms_key_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of the keystore file used for SSL + // encryption. If not provided, Dataproc will provide a self-signed + // certificate. + string keystore_uri = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of the truststore file used for SSL + // encryption. If not provided, Dataproc will provide a self-signed + // certificate. + string truststore_uri = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the + // password to the user provided keystore. For the self-signed certificate, + // this password is generated by Dataproc. + string keystore_password_uri = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the + // password to the user provided key. For the self-signed certificate, this + // password is generated by Dataproc. + string key_password_uri = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the + // password to the user provided truststore. For the self-signed certificate, + // this password is generated by Dataproc. + string truststore_password_uri = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The remote realm the Dataproc on-cluster KDC will trust, should + // the user enable cross realm trust. + string cross_realm_trust_realm = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The KDC (IP or hostname) for the remote trusted realm in a cross + // realm trust relationship. + string cross_realm_trust_kdc = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The admin server (IP or hostname) for the remote trusted realm in + // a cross realm trust relationship. + string cross_realm_trust_admin_server = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the + // shared password between the on-cluster Kerberos realm and the remote + // trusted realm, in a cross realm trust relationship. + string cross_realm_trust_shared_password_uri = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud Storage URI of a KMS encrypted file containing the + // master key of the KDC database. + string kdc_db_key_uri = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The lifetime of the ticket granting ticket, in hours. + // If not specified, or user specifies 0, then default value 10 + // will be used. + int32 tgt_lifetime_hours = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the on-cluster Kerberos realm. + // If not specified, the uppercased domain of hostnames will be the realm. + string realm = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// Identity related configuration, including service account based +// secure multi-tenancy user mappings. +message IdentityConfig { + // Required. Map of user to service account. + map user_service_account_mapping = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies the selection and config of software inside the cluster. +message SoftwareConfig { + // Optional. The version of software inside the cluster. It must be one of the + // supported [Dataproc + // Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions), + // such as "1.2" (including a subminor version, such as "1.2.29"), or the + // ["preview" + // version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions). + // If unspecified, it defaults to the latest Debian version. + string image_version = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The properties to set on daemon config files. + // + // Property keys are specified in `prefix:property` format, for example + // `core:hadoop.tmp.dir`. The following are supported prefixes + // and their mappings: + // + // * capacity-scheduler: `capacity-scheduler.xml` + // * core: `core-site.xml` + // * distcp: `distcp-default.xml` + // * hdfs: `hdfs-site.xml` + // * hive: `hive-site.xml` + // * mapred: `mapred-site.xml` + // * pig: `pig.properties` + // * spark: `spark-defaults.conf` + // * yarn: `yarn-site.xml` + // + // For more information, see [Cluster + // properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties). + map properties = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The set of components to activate on the cluster. + repeated Component optional_components = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Specifies the cluster auto-delete schedule configuration. +message LifecycleConfig { + // Optional. The duration to keep the cluster alive while idling (when no jobs + // are running). Passing this threshold will cause the cluster to be + // deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON + // representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Duration idle_delete_ttl = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Either the exact time the cluster should be deleted at or + // the cluster maximum age. + oneof ttl { + // Optional. The time when cluster will be auto-deleted (see JSON + // representation of + // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Timestamp auto_delete_time = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The lifetime duration of cluster. The cluster will be + // auto-deleted at the end of this period. Minimum value is 10 minutes; + // maximum value is 14 days (see JSON representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Duration auto_delete_ttl = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The time when cluster became idle (most recent job finished) + // and became eligible for deletion due to idleness (see JSON representation + // of + // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Timestamp idle_start_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Specifies a Metastore configuration. +message MetastoreConfig { + // Required. Resource name of an existing Dataproc Metastore service. + // + // Example: + // + // * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]` + string dataproc_metastore_service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Contains cluster daemon metrics, such as HDFS and YARN stats. +// +// **Beta Feature**: This report is available for testing purposes only. It may +// be changed before final release. +message ClusterMetrics { + // The HDFS metrics. + map hdfs_metrics = 1; + + // YARN metrics. + map yarn_metrics = 2; +} + +// Dataproc metric config. +message DataprocMetricConfig { + // A source for the collection of Dataproc custom metrics (see [Custom + // metrics] + // (https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics)). + enum MetricSource { + // Required unspecified metric source. + METRIC_SOURCE_UNSPECIFIED = 0; + + // Monitoring agent metrics. If this source is enabled, + // Dataproc enables the monitoring agent in Compute Engine, + // and collects monitoring agent metrics, which are published + // with an `agent.googleapis.com` prefix. + MONITORING_AGENT_DEFAULTS = 1; + + // HDFS metric source. + HDFS = 2; + + // Spark metric source. + SPARK = 3; + + // YARN metric source. + YARN = 4; + + // Spark History Server metric source. + SPARK_HISTORY_SERVER = 5; + + // Hiveserver2 metric source. + HIVESERVER2 = 6; + + // hivemetastore metric source + HIVEMETASTORE = 7; + } + + // A Dataproc custom metric. + message Metric { + // Required. A standard set of metrics is collected unless `metricOverrides` + // are specified for the metric source (see [Custom metrics] + // (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) + // for more information). + MetricSource metric_source = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specify one or more [Custom metrics] + // (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) + // to collect for the metric course (for the `SPARK` metric source (any + // [Spark metric] + // (https://spark.apache.org/docs/latest/monitoring.html#metrics) can be + // specified). + // + // Provide metrics in the following format: + // METRIC_SOURCE:INSTANCE:GROUP:METRIC + // Use camelcase as appropriate. + // + // Examples: + // + // ``` + // yarn:ResourceManager:QueueMetrics:AppsCompleted + // spark:driver:DAGScheduler:job.allJobs + // sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed + // hiveserver2:JVM:Memory:NonHeapMemoryUsage.used + // ``` + // + // Notes: + // + // * Only the specified overridden metrics are collected for the + // metric source. For example, if one or more `spark:executive` metrics + // are listed as metric overrides, other `SPARK` metrics are not + // collected. The collection of the metrics for other enabled custom + // metric sources is unaffected. For example, if both `SPARK` andd `YARN` + // metric sources are enabled, and overrides are provided for Spark + // metrics only, all YARN metrics are collected. + repeated string metric_overrides = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Metrics sources to enable. + repeated Metric metrics = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to create a cluster. +message CreateClusterRequest { + // Required. The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster to create. + Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique ID used to identify the request. If the server receives + // two + // [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s + // with the same id, then the second request will be ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure action when primary worker creation fails. + FailureAction action_on_failed_primary_workers = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a cluster. +message UpdateClusterRequest { + // Required. The ID of the Google Cloud Platform project the + // cluster belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The changes to the cluster. + Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Timeout for graceful YARN decommissioning. Graceful + // decommissioning allows removing nodes from the cluster without + // interrupting jobs in progress. Timeout specifies how long to wait for jobs + // in progress to finish before forcefully removing nodes (and potentially + // interrupting jobs). Default timeout is 0 (for forceful decommission), and + // the maximum allowed timeout is 1 day. (see JSON representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + // + // Only supported on Dataproc image versions 1.2 and higher. + google.protobuf.Duration graceful_decommission_timeout = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. Specifies the path, relative to `Cluster`, of + // the field to update. For example, to change the number of workers + // in a cluster to 5, the `update_mask` parameter would be + // specified as `config.worker_config.num_instances`, + // and the `PATCH` request body would specify the new value, as follows: + // + // { + // "config":{ + // "workerConfig":{ + // "numInstances":"5" + // } + // } + // } + // Similarly, to change the number of preemptible workers in a cluster to 5, + // the `update_mask` parameter would be + // `config.secondary_worker_config.num_instances`, and the `PATCH` request + // body would be set as follows: + // + // { + // "config":{ + // "secondaryWorkerConfig":{ + // "numInstances":"5" + // } + // } + // } + // Note: Currently, only the following fields can be updated: + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + //
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or + // change autoscaling policies
+ google.protobuf.FieldMask update_mask = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique ID used to identify the request. If the server + // receives two + // [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s + // with the same id, then the second request will be ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to stop a cluster. +message StopClusterRequest { + // Required. The ID of the Google Cloud Platform project the + // cluster belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specifying the `cluster_uuid` means the RPC will fail + // (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique ID used to identify the request. If the server + // receives two + // [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s + // with the same id, then the second request will be ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to start a cluster. +message StartClusterRequest { + // Required. The ID of the Google Cloud Platform project the + // cluster belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specifying the `cluster_uuid` means the RPC will fail + // (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique ID used to identify the request. If the server + // receives two + // [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s + // with the same id, then the second request will be ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to delete a cluster. +message DeleteClusterRequest { + // Required. The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specifying the `cluster_uuid` means the RPC should fail + // (with error NOT_FOUND) if cluster with specified UUID does not exist. + string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique ID used to identify the request. If the server + // receives two + // [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s + // with the same id, then the second request will be ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request to get the resource representation for a cluster in a project. +message GetClusterRequest { + // Required. The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to list the clusters in a project. +message ListClustersRequest { + // Required. The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A filter constraining the clusters to list. Filters are + // case-sensitive and have the following syntax: + // + // field = value [AND [field = value]] ... + // + // where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, + // and `[KEY]` is a label key. **value** can be `*` to match all values. + // `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, + // `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` + // contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` + // contains the `DELETING` and `ERROR` states. + // `clusterName` is the name of the cluster provided at creation time. + // Only the logical `AND` operator is supported; space-separated items are + // treated as having an implicit `AND` operator. + // + // Example filter: + // + // status.state = ACTIVE AND clusterName = mycluster + // AND labels.env = staging AND labels.starred = * + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The standard List page size. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The standard List page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The list of all clusters in a project. +message ListClustersResponse { + // Output only. The clusters in the project. + repeated Cluster clusters = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This token is included in the response if there are more + // results to fetch. To fetch additional results, provide this value as the + // `page_token` in a subsequent `ListClustersRequest`. + string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request to collect cluster diagnostic information. +message DiagnoseClusterRequest { + // Required. The ID of the Google Cloud Platform project that the cluster + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster name. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The output Cloud Storage directory for the diagnostic + // tarball. If not specified, a task-specific directory in the cluster's + // staging bucket will be used. + string tarball_gcs_dir = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Time interval in which diagnosis should be carried out on the + // cluster. + google.type.Interval diagnosis_interval = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies a list of jobs on which diagnosis is to be performed. + // Format: projects/{project}/regions/{region}/jobs/{job} + repeated string jobs = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies a list of yarn applications on which diagnosis is to be + // performed. + repeated string yarn_application_ids = 11 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The location of diagnostic output. +message DiagnoseClusterResults { + // Output only. The Cloud Storage URI of the diagnostic output. + // The output report is a plain text file with a summary of collected + // diagnostics. + string output_uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Reservation Affinity for consuming Zonal reservation. +message ReservationAffinity { + // Indicates whether to consume capacity from an reservation or not. + enum Type { + TYPE_UNSPECIFIED = 0; + + // Do not consume from any allocated capacity. + NO_RESERVATION = 1; + + // Consume any reservation available. + ANY_RESERVATION = 2; + + // Must consume from a specific reservation. Must specify key value fields + // for specifying the reservations. + SPECIFIC_RESERVATION = 3; + } + + // Optional. Type of reservation to consume + Type consume_reservation_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Corresponds to the label key of reservation resource. + string key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Corresponds to the label values of reservation resource. + repeated string values = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto new file mode 100644 index 000000000000..061cccc6c23a --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto @@ -0,0 +1,993 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "JobsProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The JobController provides methods to manage jobs. +service JobController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Submits a job to a cluster. + rpc SubmitJob(SubmitJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/jobs:submit" + body: "*" + }; + option (google.api.method_signature) = "project_id,region,job"; + } + + // Submits job to a cluster. + rpc SubmitJobAsOperation(SubmitJobRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/jobs:submitAsOperation" + body: "*" + }; + option (google.api.method_signature) = "project_id, region, job"; + option (google.longrunning.operation_info) = { + response_type: "Job" + metadata_type: "JobMetadata" + }; + } + + // Gets the resource representation for a job in a project. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" + }; + option (google.api.method_signature) = "project_id,region,job_id"; + } + + // Lists regions/{region}/jobs in a project. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/regions/{region}/jobs" + }; + option (google.api.method_signature) = "project_id,region"; + option (google.api.method_signature) = "project_id,region,filter"; + } + + // Updates a job in a project. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + patch: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" + body: "job" + }; + } + + // Starts a job cancellation request. To access the job resource + // after cancellation, call + // [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) + // or + // [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). + rpc CancelJob(CancelJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}:cancel" + body: "*" + }; + option (google.api.method_signature) = "project_id,region,job_id"; + } + + // Deletes the job from the project. If the job is active, the delete fails, + // and the response returns `FAILED_PRECONDITION`. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" + }; + option (google.api.method_signature) = "project_id,region,job_id"; + } +} + +// The runtime logging config of the job. +message LoggingConfig { + // The Log4j level for job execution. When running an + // [Apache Hive](https://hive.apache.org/) job, Cloud + // Dataproc configures the Hive client to an equivalent verbosity level. + enum Level { + // Level is unspecified. Use default level for log4j. + LEVEL_UNSPECIFIED = 0; + + // Use ALL level for log4j. + ALL = 1; + + // Use TRACE level for log4j. + TRACE = 2; + + // Use DEBUG level for log4j. + DEBUG = 3; + + // Use INFO level for log4j. + INFO = 4; + + // Use WARN level for log4j. + WARN = 5; + + // Use ERROR level for log4j. + ERROR = 6; + + // Use FATAL level for log4j. + FATAL = 7; + + // Turn off log4j. + OFF = 8; + } + + // The per-package log levels for the driver. This may include + // "root" package name to configure rootLogger. + // Examples: + // - 'com.google = FATAL' + // - 'root = INFO' + // - 'org.apache = DEBUG' + map driver_log_levels = 2; +} + +// A Dataproc job for running +// [Apache Hadoop +// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) +// jobs on [Apache Hadoop +// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html). +message HadoopJob { + // Required. Indicates the location of the driver's main class. Specify + // either the jar file that contains the main class or the main class name. + // To specify both, add the jar file to `jar_file_uris`, and then specify + // the main class name in this property. + oneof driver { + // The HCFS URI of the jar file containing the main class. + // Examples: + // 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar' + // 'hdfs:/tmp/test-samples/custom-wordcount.jar' + // 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar' + string main_jar_file_uri = 1; + + // The name of the driver's main class. The jar file containing the class + // must be in the default CLASSPATH or specified in `jar_file_uris`. + string main_class = 2; + } + + // Optional. The arguments to pass to the driver. Do not + // include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as + // job properties, since a collision may occur that causes an incorrect job + // submission. + repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Jar file URIs to add to the CLASSPATHs of the + // Hadoop driver and tasks. + repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied + // to the working directory of Hadoop drivers and distributed tasks. Useful + // for naively parallel tasks. + repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted in the working directory of + // Hadoop drivers and tasks. Supported file types: + // .jar, .tar, .tar.gz, .tgz, or .zip. + repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure Hadoop. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and + // classes in user code. + map properties = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running [Apache Spark](https://spark.apache.org/) +// applications on YARN. +message SparkJob { + // Required. The specification of the main method to call to drive the job. + // Specify either the jar file that contains the main class or the main class + // name. To pass both a main jar and a main class in that jar, add the jar to + // `CommonJob.jar_file_uris`, and then specify the main class name in + // `main_class`. + oneof driver { + // The HCFS URI of the jar file that contains the main class. + string main_jar_file_uri = 1; + + // The name of the driver's main class. The jar file that contains the class + // must be in the default CLASSPATH or specified in `jar_file_uris`. + string main_class = 2; + } + + // Optional. The arguments to pass to the driver. Do not include arguments, + // such as `--conf`, that can be set as job properties, since a collision may + // occur that causes an incorrect job submission. + repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the CLASSPATHs of the + // Spark driver and tasks. + repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. Useful for naively parallel tasks. + repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // .jar, .tar, .tar.gz, .tgz, and .zip. + repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure Spark. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in + // /etc/spark/conf/spark-defaults.conf and classes in user code. + map properties = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running +// [Apache +// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html) +// applications on YARN. +message PySparkJob { + // Required. The HCFS URI of the main Python file to use as the driver. Must + // be a .py file. + string main_python_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The arguments to pass to the driver. Do not include arguments, + // such as `--conf`, that can be set as job properties, since a collision may + // occur that causes an incorrect job submission. + repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS file URIs of Python files to pass to the PySpark + // framework. Supported file types: .py, .egg, and .zip. + repeated string python_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the CLASSPATHs of the + // Python driver and tasks. + repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. Useful for naively parallel tasks. + repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // .jar, .tar, .tar.gz, .tgz, and .zip. + repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure PySpark. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in + // /etc/spark/conf/spark-defaults.conf and classes in user code. + map properties = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A list of queries to run on a cluster. +message QueryList { + // Required. The queries to execute. You do not need to end a query expression + // with a semicolon. Multiple queries can be specified in one + // string by separating each with a semicolon. Here is an example of a + // Dataproc API snippet that uses a QueryList to specify a HiveJob: + // + // "hiveJob": { + // "queryList": { + // "queries": [ + // "query1", + // "query2", + // "query3;query4", + // ] + // } + // } + repeated string queries = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A Dataproc job for running [Apache Hive](https://hive.apache.org/) +// queries on YARN. +message HiveJob { + // Required. The sequence of Hive queries to execute, specified as either + // an HCFS file URI or a list of queries. + oneof queries { + // The HCFS URI of the script that contains Hive queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // Optional. Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when + // executing independent parallel queries. + bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Mapping of query variable names to values (equivalent to the + // Hive command: `SET name="value";`). + map script_variables = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names and values, used to configure Hive. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`, + // /etc/hive/conf/hive-site.xml, and classes in user code. + map properties = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the CLASSPATH of the + // Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes + // and UDFs. + repeated string jar_file_uris = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running [Apache Spark +// SQL](https://spark.apache.org/sql/) queries. +message SparkSqlJob { + // Required. The sequence of Spark SQL queries to execute, specified as + // either an HCFS file URI or as a list of queries. + oneof queries { + // The HCFS URI of the script that contains SQL queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // Optional. Mapping of query variable names to values (equivalent to the + // Spark SQL command: SET `name="value";`). + map script_variables = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure + // Spark SQL's SparkConf. Properties that conflict with values set by the + // Dataproc API may be overwritten. + map properties = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. + repeated string jar_file_uris = 56 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running [Apache Pig](https://pig.apache.org/) +// queries on YARN. +message PigJob { + // Required. The sequence of Pig queries to execute, specified as an HCFS + // file URI or a list of queries. + oneof queries { + // The HCFS URI of the script that contains the Pig queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // Optional. Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when + // executing independent parallel queries. + bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Mapping of query variable names to values (equivalent to the Pig + // command: `name=[value]`). + map script_variables = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure Pig. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`, + // /etc/pig/conf/pig.properties, and classes in user code. + map properties = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of jar files to add to the CLASSPATH of + // the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs. + repeated string jar_file_uris = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running +// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html) +// applications on YARN. +message SparkRJob { + // Required. The HCFS URI of the main R file to use as the driver. + // Must be a .R file. + string main_r_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The arguments to pass to the driver. Do not include arguments, + // such as `--conf`, that can be set as job properties, since a collision may + // occur that causes an incorrect job submission. + repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of files to be placed in the working directory of + // each executor. Useful for naively parallel tasks. + repeated string file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. HCFS URIs of archives to be extracted into the working directory + // of each executor. Supported file types: + // .jar, .tar, .tar.gz, .tgz, and .zip. + repeated string archive_uris = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, used to configure SparkR. + // Properties that conflict with values set by the Dataproc API may be + // overwritten. Can include properties set in + // /etc/spark/conf/spark-defaults.conf and classes in user code. + map properties = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running [Presto](https://prestosql.io/) queries. +// **IMPORTANT**: The [Dataproc Presto Optional +// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto) +// must be enabled when the cluster is created to submit a Presto job to the +// cluster. +message PrestoJob { + // Required. The sequence of Presto queries to execute, specified as + // either an HCFS file URI or as a list of queries. + oneof queries { + // The HCFS URI of the script that contains SQL queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // Optional. Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when + // executing independent parallel queries. + bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The format in which query output will be displayed. See the + // Presto documentation for supported output formats + string output_format = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Presto client tags to attach to this query + repeated string client_tags = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values. Used to set Presto + // [session properties](https://prestodb.io/docs/current/sql/set-session.html) + // Equivalent to using the --session flag in the Presto CLI + map properties = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job for running [Trino](https://trino.io/) queries. +// **IMPORTANT**: The [Dataproc Trino Optional +// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino) +// must be enabled when the cluster is created to submit a Trino job to the +// cluster. +message TrinoJob { + // Required. The sequence of Trino queries to execute, specified as + // either an HCFS file URI or as a list of queries. + oneof queries { + // The HCFS URI of the script that contains SQL queries. + string query_file_uri = 1; + + // A list of queries. + QueryList query_list = 2; + } + + // Optional. Whether to continue executing queries if a query fails. + // The default value is `false`. Setting to `true` can be useful when + // executing independent parallel queries. + bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The format in which query output will be displayed. See the + // Trino documentation for supported output formats + string output_format = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Trino client tags to attach to this query + repeated string client_tags = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values. Used to set Trino + // [session properties](https://trino.io/docs/current/sql/set-session.html) + // Equivalent to using the --session flag in the Trino CLI + map properties = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The runtime log config for job execution. + LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Dataproc job config. +message JobPlacement { + // Required. The name of the cluster where the job will be submitted. + string cluster_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. A cluster UUID generated by the Dataproc service when + // the job is submitted. + string cluster_uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Cluster labels to identify a cluster where the job will be + // submitted. + map cluster_labels = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Dataproc job status. +message JobStatus { + // The job state. + enum State { + // The job state is unknown. + STATE_UNSPECIFIED = 0; + + // The job is pending; it has been submitted, but is not yet running. + PENDING = 1; + + // Job has been received by the service and completed initial setup; + // it will soon be submitted to the cluster. + SETUP_DONE = 8; + + // The job is running on the cluster. + RUNNING = 2; + + // A CancelJob request has been received, but is pending. + CANCEL_PENDING = 3; + + // Transient in-flight resources have been canceled, and the request to + // cancel the running job has been issued to the cluster. + CANCEL_STARTED = 7; + + // The job cancellation was successful. + CANCELLED = 4; + + // The job has completed successfully. + DONE = 5; + + // The job has completed, but encountered an error. + ERROR = 6; + + // Job attempt has failed. The detail field contains failure details for + // this attempt. + // + // Applies to restartable jobs only. + ATTEMPT_FAILURE = 9; + } + + // The job substate. + enum Substate { + // The job substate is unknown. + UNSPECIFIED = 0; + + // The Job is submitted to the agent. + // + // Applies to RUNNING state. + SUBMITTED = 1; + + // The Job has been received and is awaiting execution (it may be waiting + // for a condition to be met). See the "details" field for the reason for + // the delay. + // + // Applies to RUNNING state. + QUEUED = 2; + + // The agent-reported status is out of date, which may be caused by a + // loss of communication between the agent and Dataproc. If the + // agent does not send a timely update, the job will fail. + // + // Applies to RUNNING state. + STALE_STATUS = 3; + } + + // Output only. A state message specifying the overall job state. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. Job state details, such as an error + // description if the state is ERROR. + string details = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; + + // Output only. The time when this state was entered. + google.protobuf.Timestamp state_start_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional state information, which includes + // status reported by the agent. + Substate substate = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Encapsulates the full scoping used to reference a job. +message JobReference { + // Optional. The ID of the Google Cloud Platform project that the job belongs + // to. If specified, must match the request project ID. + string project_id = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The job ID, which must be unique within the project. + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), or hyphens (-). The maximum length is 100 characters. + // + // If not specified by the caller, the job ID will be provided by the server. + string job_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A YARN application created by a job. Application information is a subset of +// org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto. +// +// **Beta Feature**: This report is available for testing purposes only. It may +// be changed before final release. +message YarnApplication { + // The application state, corresponding to + // YarnProtos.YarnApplicationStateProto. + enum State { + // Status is unspecified. + STATE_UNSPECIFIED = 0; + + // Status is NEW. + NEW = 1; + + // Status is NEW_SAVING. + NEW_SAVING = 2; + + // Status is SUBMITTED. + SUBMITTED = 3; + + // Status is ACCEPTED. + ACCEPTED = 4; + + // Status is RUNNING. + RUNNING = 5; + + // Status is FINISHED. + FINISHED = 6; + + // Status is FAILED. + FAILED = 7; + + // Status is KILLED. + KILLED = 8; + } + + // Required. The application name. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The application state. + State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The numerical progress of the application, from 1 to 100. + float progress = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or + // TimelineServer that provides application-specific information. The URL uses + // the internal hostname, and requires a proxy server for resolution and, + // possibly, access. + string tracking_url = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A Dataproc job resource. +message Job { + // Optional. The fully qualified reference to the job, which can be used to + // obtain the equivalent REST path of the job resource. If this property + // is not specified when a job is created, the server generates a + // job_id. + JobReference reference = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Job information, including how, when, and where to + // run the job. + JobPlacement placement = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The application/framework-specific portion of the job. + oneof type_job { + // Optional. Job is a Hadoop job. + HadoopJob hadoop_job = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Spark job. + SparkJob spark_job = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a PySpark job. + PySparkJob pyspark_job = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Hive job. + HiveJob hive_job = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Pig job. + PigJob pig_job = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a SparkR job. + SparkRJob spark_r_job = 21 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a SparkSql job. + SparkSqlJob spark_sql_job = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Presto job. + PrestoJob presto_job = 23 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Trino job. + TrinoJob trino_job = 28 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The job status. Additional application-specific + // status information may be contained in the type_job + // and yarn_applications fields. + JobStatus status = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The previous job status. + repeated JobStatus status_history = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The collection of YARN applications spun up by this job. + // + // **Beta** Feature: This report is available for testing purposes only. It + // may be changed before final release. + repeated YarnApplication yarn_applications = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A URI pointing to the location of the stdout of the job's + // driver program. + string driver_output_resource_uri = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If present, the location of miscellaneous control files + // which may be used as part of job setup and handling. If not present, + // control files may be placed in the same location as `driver_output_uri`. + string driver_control_files_uri = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The labels to associate with this job. + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to [RFC + // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be + // associated with a job. + map labels = 18 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job scheduling configuration. + JobScheduling scheduling = 20 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. A UUID that uniquely identifies a job within the project + // over time. This is in contrast to a user-settable reference.job_id that + // may be reused over time. + string job_uuid = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether the job is completed. If the value is + // `false`, the job is still in progress. If `true`, the job is completed, and + // `status.state` field will indicate if it was successful, failed, + // or cancelled. + bool done = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Driver scheduling configuration. + DriverSchedulingConfig driver_scheduling_config = 27 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Driver scheduling configuration. +message DriverSchedulingConfig { + // Required. The amount of memory in MB the driver is requesting. + int32 memory_mb = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The number of vCPUs the driver is requesting. + int32 vcores = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Job scheduling options. +message JobScheduling { + // Optional. Maximum number of times per hour a driver may be restarted as + // a result of driver exiting with non-zero code before job is + // reported failed. + // + // A job may be reported as thrashing if the driver exits with a non-zero code + // four times within a 10-minute window. + // + // Maximum value is 10. + // + // **Note:** This restartable job option is not supported in Dataproc + // [workflow templates] + // (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). + int32 max_failures_per_hour = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Maximum total number of times a driver may be restarted as a + // result of the driver exiting with a non-zero code. After the maximum number + // is reached, the job will be reported as failed. + // + // Maximum value is 240. + // + // **Note:** Currently, this restartable job option is + // not supported in Dataproc + // [workflow + // templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). + int32 max_failures_total = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to submit a job. +message SubmitJobRequest { + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job resource. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique id used to identify the request. If the server + // receives two + // [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s + // with the same id, then the second request will be ignored and the + // first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend + // is returned. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The id must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Job Operation metadata. +message JobMetadata { + // Output only. The job id. + string job_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Most recent job status. + JobStatus status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Operation type. + string operation_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Job submission time. + google.protobuf.Timestamp start_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request to get the resource representation for a job in a project. +message GetJobRequest { + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job ID. + string job_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to list jobs in a project. +message ListJobsRequest { + // A matcher that specifies categories of job states. + enum JobStateMatcher { + // Match all jobs, regardless of state. + ALL = 0; + + // Only match jobs in non-terminal states: PENDING, RUNNING, or + // CANCEL_PENDING. + ACTIVE = 1; + + // Only match jobs in terminal states: CANCELLED, DONE, or ERROR. + NON_ACTIVE = 2; + } + + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The number of results to return in each response. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page token, returned by a previous call, to request the + // next page of results. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, the returned jobs list includes only jobs that were + // submitted to the named cluster. + string cluster_name = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies enumerated categories of jobs to list. + // (default = match ALL jobs). + // + // If `filter` is provided, `jobStateMatcher` will be ignored. + JobStateMatcher job_state_matcher = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter constraining the jobs to list. Filters are + // case-sensitive and have the following syntax: + // + // [field = value] AND [field [= value]] ... + // + // where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label + // key. **value** can be `*` to match all values. + // `status.state` can be either `ACTIVE` or `NON_ACTIVE`. + // Only the logical `AND` operator is supported; space-separated items are + // treated as having an implicit `AND` operator. + // + // Example filter: + // + // status.state = ACTIVE AND labels.env = staging AND labels.starred = * + string filter = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a job. +message UpdateJobRequest { + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job ID. + string job_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The changes to the job. + Job job = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specifies the path, relative to Job, of + // the field to update. For example, to update the labels of a Job the + // update_mask parameter would be specified as + // labels, and the `PATCH` request body would specify the new + // value. Note: Currently, labels is the only + // field that can be updated. + google.protobuf.FieldMask update_mask = 5 + [(google.api.field_behavior) = REQUIRED]; +} + +// A list of jobs in a project. +message ListJobsResponse { + // Output only. Jobs list. + repeated Job jobs = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. This token is included in the response if there are more results + // to fetch. To fetch additional results, provide this value as the + // `page_token` in a subsequent ListJobsRequest. + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to cancel a job. +message CancelJobRequest { + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job ID. + string job_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to delete a job. +message DeleteJobRequest { + // Required. The ID of the Google Cloud Platform project that the job + // belongs to. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Dataproc region in which to handle the request. + string region = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job ID. + string job_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto new file mode 100644 index 000000000000..5a0509728082 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto @@ -0,0 +1,174 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/clusters.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "NodeGroupsProto"; +option java_package = "com.google.cloud.dataproc.v1"; +option (google.api.resource_definition) = { + type: "dataproc.googleapis.com/ClusterRegion" + pattern: "projects/{project}/regions/{region}/clusters/{cluster}" +}; + +// The `NodeGroupControllerService` provides methods to manage node groups +// of Compute Engine managed instances. +service NodeGroupController { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a node group in a cluster. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] is + // [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + rpc CreateNodeGroup(CreateNodeGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/regions/*/clusters/*}/nodeGroups" + body: "node_group" + }; + option (google.api.method_signature) = "parent,node_group,node_group_id"; + option (google.longrunning.operation_info) = { + response_type: "NodeGroup" + metadata_type: "google.cloud.dataproc.v1.NodeGroupOperationMetadata" + }; + } + + // Resizes a node group in a cluster. The returned + // [Operation.metadata][google.longrunning.Operation.metadata] is + // [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + rpc ResizeNodeGroup(ResizeNodeGroupRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}:resize" + body: "*" + }; + option (google.api.method_signature) = "name,size"; + option (google.longrunning.operation_info) = { + response_type: "NodeGroup" + metadata_type: "google.cloud.dataproc.v1.NodeGroupOperationMetadata" + }; + } + + // Gets the resource representation for a node group in a + // cluster. + rpc GetNodeGroup(GetNodeGroupRequest) returns (NodeGroup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// A request to create a node group. +message CreateNodeGroupRequest { + // Required. The parent resource where this node group will be created. + // Format: `projects/{project}/regions/{region}/clusters/{cluster}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/NodeGroup" + } + ]; + + // Required. The node group to create. + NodeGroup node_group = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional node group ID. Generated if not specified. + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). Cannot begin or end with underscore + // or hyphen. Must consist of from 3 to 33 characters. + string node_group_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A unique ID used to identify the request. If the server receives + // two + // [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + // with the same ID, the second request is ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to resize a node group. +message ResizeNodeGroupRequest { + // Required. The name of the node group to resize. + // Format: + // `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The number of running instances for the node group to maintain. + // The group adds or removes instances to maintain the number of instances + // specified by this parameter. + int32 size = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique ID used to identify the request. If the server receives + // two + // [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + // with the same ID, the second request is ignored and the + // first [google.longrunning.Operation][google.longrunning.Operation] created + // and stored in the backend is returned. + // + // Recommendation: Set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The ID must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Timeout for graceful YARN decommissioning. [Graceful + // decommissioning] + // (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + // allows the removal of nodes from the Compute Engine node group + // without interrupting jobs in progress. This timeout specifies how long to + // wait for jobs in progress to finish before forcefully removing nodes (and + // potentially interrupting jobs). Default timeout is 0 (for forceful + // decommission), and the maximum allowed timeout is 1 day. (see JSON + // representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + // + // Only supported on Dataproc image versions 1.2 and higher. + google.protobuf.Duration graceful_decommission_timeout = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to get a node group . +message GetNodeGroupRequest { + // Required. The name of the node group to retrieve. + // Format: + // `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/NodeGroup" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto new file mode 100644 index 000000000000..d9fad26d2128 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto @@ -0,0 +1,170 @@ +// 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.dataproc.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// Metadata describing the Batch operation. +message BatchOperationMetadata { + // Operation type for Batch resources + enum BatchOperationType { + // Batch operation type is unknown. + BATCH_OPERATION_TYPE_UNSPECIFIED = 0; + + // Batch operation type. + BATCH = 1; + } + + // Name of the batch for the operation. + string batch = 1; + + // Batch UUID for the operation. + string batch_uuid = 2; + + // The time when the operation was created. + google.protobuf.Timestamp create_time = 3; + + // The time when the operation finished. + google.protobuf.Timestamp done_time = 4; + + // The operation type. + BatchOperationType operation_type = 6; + + // Short description of the operation. + string description = 7; + + // Labels associated with the operation. + map labels = 8; + + // Warnings encountered during operation execution. + repeated string warnings = 9; +} + +// The status of the operation. +message ClusterOperationStatus { + // The operation state. + enum State { + // Unused. + UNKNOWN = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation is done; either cancelled or completed. + DONE = 3; + } + + // Output only. A message containing the operation state. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A message containing the detailed operation state. + string inner_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A message containing any operation metadata details. + string details = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this state was entered. + google.protobuf.Timestamp state_start_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata describing the operation. +message ClusterOperationMetadata { + // Output only. Name of the cluster for the operation. + string cluster_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Cluster UUID for the operation. + string cluster_uuid = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current operation status. + ClusterOperationStatus status = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The previous operation status. + repeated ClusterOperationStatus status_history = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The operation type. + string operation_type = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Short description of operation. + string description = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Labels associated with the operation + map labels = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Errors encountered during operation execution. + repeated string warnings = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Child operation ids + repeated string child_operation_ids = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata describing the node group operation. +message NodeGroupOperationMetadata { + // Operation type for node group resources. + enum NodeGroupOperationType { + // Node group operation type is unknown. + NODE_GROUP_OPERATION_TYPE_UNSPECIFIED = 0; + + // Create node group operation type. + CREATE = 1; + + // Update node group operation type. + UPDATE = 2; + + // Delete node group operation type. + DELETE = 3; + + // Resize node group operation type. + RESIZE = 4; + } + + // Output only. Node group ID for the operation. + string node_group_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Cluster UUID associated with the node group operation. + string cluster_uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current operation status. + ClusterOperationStatus status = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The previous operation status. + repeated ClusterOperationStatus status_history = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The operation type. + NodeGroupOperationType operation_type = 5; + + // Output only. Short description of operation. + string description = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Labels associated with the operation. + map labels = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Errors encountered during operation execution. + repeated string warnings = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto new file mode 100644 index 000000000000..e3f1091e1802 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto @@ -0,0 +1,476 @@ +// 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.dataproc.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "SharedProto"; +option java_package = "com.google.cloud.dataproc.v1"; +option (google.api.resource_definition) = { + type: "container.googleapis.com/Cluster" + pattern: "projects/{project}/locations/{location}/clusters/{cluster}" +}; +option (google.api.resource_definition) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; + +// Runtime configuration for a workload. +message RuntimeConfig { + // Optional. Version of the batch runtime. + string version = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional custom container image for the job runtime environment. + // If not specified, a default container image will be used. + string container_image = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A mapping of property names to values, which are used to + // configure workload execution. + map properties = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Environment configuration for a workload. +message EnvironmentConfig { + // Optional. Execution configuration for a workload. + ExecutionConfig execution_config = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Peripherals configuration that workload has access to. + PeripheralsConfig peripherals_config = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Execution configuration for a workload. +message ExecutionConfig { + // Optional. Service account that used to execute workload. + string service_account = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Network configuration for workload execution. + oneof network { + // Optional. Network URI to connect workload to. + string network_uri = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Subnetwork URI to connect workload to. + string subnetwork_uri = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Tags used for network traffic control. + repeated string network_tags = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Cloud KMS key to use for encryption. + string kms_key = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The duration after which the workload will be terminated. + // When the workload passes this ttl, it will be unconditionally killed + // without waiting for ongoing work to finish. + // Minimum value is 10 minutes; maximum value is 14 days (see JSON + // representation of + // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + // If both ttl and idle_ttl are specified, the conditions are treated as + // and OR: the workload will be terminated when it has been idle for idle_ttl + // or when the ttl has passed, whichever comes first. + // If ttl is not specified for a session, it defaults to 24h. + google.protobuf.Duration ttl = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A Cloud Storage bucket used to stage workload dependencies, + // config files, and store workload output and other ephemeral data, such as + // Spark history files. If you do not specify a staging bucket, Cloud Dataproc + // will determine a Cloud Storage location according to the region where your + // workload is running, and then create and manage project-level, per-location + // staging and temporary buckets. + // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to + // a Cloud Storage bucket.** + string staging_bucket = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +// Spark History Server configuration for the workload. +message SparkHistoryServerConfig { + // Optional. Resource name of an existing Dataproc Cluster to act as a Spark + // History Server for the workload. + // + // Example: + // + // * `projects/[project_id]/regions/[region]/clusters/[cluster_name]` + string dataproc_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Auxiliary services configuration for a workload. +message PeripheralsConfig { + // Optional. Resource name of an existing Dataproc Metastore service. + // + // Example: + // + // * `projects/[project_id]/locations/[region]/services/[service_id]` + string metastore_service = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The Spark History Server configuration for the workload. + SparkHistoryServerConfig spark_history_server_config = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Runtime information about workload execution. +message RuntimeInfo { + // Output only. Map of remote access endpoints (such as web interfaces and + // APIs) to their URIs. + map endpoints = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A URI pointing to the location of the stdout and stderr of the + // workload. + string output_uri = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A URI pointing to the location of the diagnostics tarball. + string diagnostic_output_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Approximate workload resource usage calculated after workload + // finishes (see [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + UsageMetrics approximate_usage = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Snapshot of current workload resource usage. + UsageSnapshot current_usage = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Usage metrics represent approximate total resources consumed by a workload. +message UsageMetrics { + // Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`) + // (see [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + int64 milli_dcu_seconds = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Shuffle storage usage in (`GB` x `seconds`) (see + // [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + int64 shuffle_storage_gb_seconds = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The usage snaphot represents the resources consumed by a workload at a +// specified time. +message UsageSnapshot { + // Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see + // [Dataproc Serverless pricing] + // (https://cloud.google.com/dataproc-serverless/pricing)). + int64 milli_dcu = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless + // pricing] (https://cloud.google.com/dataproc-serverless/pricing)) + int64 shuffle_storage_gb = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The timestamp of the usage snapshot. + google.protobuf.Timestamp snapshot_time = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The cluster's GKE config. +message GkeClusterConfig { + // Optional. A target GKE cluster to deploy to. It must be in the same project + // and region as the Dataproc cluster (the GKE cluster can be zonal or + // regional). Format: + // 'projects/{project}/locations/{location}/clusters/{cluster_id}' + string gke_cluster_target = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "container.googleapis.com/Cluster" + } + ]; + + // Optional. GKE node pools where workloads will be scheduled. At least one + // node pool must be assigned the `DEFAULT` + // [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role]. + // If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT` + // `GkeNodePoolTarget`. Each role can be given to only one + // `GkeNodePoolTarget`. All node pools must have the same location settings. + repeated GkeNodePoolTarget node_pool_target = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The configuration for running the Dataproc cluster on Kubernetes. +message KubernetesClusterConfig { + // Optional. A namespace within the Kubernetes cluster to deploy into. If this + // namespace does not exist, it is created. If it exists, Dataproc verifies + // that another Dataproc VirtualCluster is not installed into it. If not + // specified, the name of the Dataproc Cluster is used. + string kubernetes_namespace = 1 [(google.api.field_behavior) = OPTIONAL]; + + oneof config { + // Required. The configuration for running the Dataproc cluster on GKE. + GkeClusterConfig gke_cluster_config = 2 + [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. The software configuration for this Dataproc cluster running on + // Kubernetes. + KubernetesSoftwareConfig kubernetes_software_config = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The software configuration for this Dataproc cluster running on Kubernetes. +message KubernetesSoftwareConfig { + // The components that should be installed in this Dataproc cluster. The key + // must be a string from the KubernetesComponent enumeration. The value is + // the version of the software to be installed. + // At least one entry must be specified. + map component_version = 1; + + // The properties to set on daemon config files. + // + // Property keys are specified in `prefix:property` format, for example + // `spark:spark.kubernetes.container.image`. The following are supported + // prefixes and their mappings: + // + // * spark: `spark-defaults.conf` + // + // For more information, see [Cluster + // properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties). + map properties = 2; +} + +// GKE node pools that Dataproc workloads run on. +message GkeNodePoolTarget { + // `Role` specifies the tasks that will run on the node pool. Roles can be + // specific to workloads. Exactly one + // [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the + // virtual cluster must have the `DEFAULT` role, which is used to run all + // workloads that are not associated with a node pool. + enum Role { + // Role is unspecified. + ROLE_UNSPECIFIED = 0; + + // At least one node pool must have the `DEFAULT` role. + // Work assigned to a role that is not associated with a node pool + // is assigned to the node pool with the `DEFAULT` role. For example, + // work assigned to the `CONTROLLER` role will be assigned to the node pool + // with the `DEFAULT` role if no node pool has the `CONTROLLER` role. + DEFAULT = 1; + + // Run work associated with the Dataproc control plane (for example, + // controllers and webhooks). Very low resource requirements. + CONTROLLER = 2; + + // Run work associated with a Spark driver of a job. + SPARK_DRIVER = 3; + + // Run work associated with a Spark executor of a job. + SPARK_EXECUTOR = 4; + } + + // Required. The target GKE node pool. + // Format: + // 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}' + string node_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The roles associated with the GKE node pool. + repeated Role roles = 2 [(google.api.field_behavior) = REQUIRED]; + + // Input only. The configuration for the GKE node pool. + // + // If specified, Dataproc attempts to create a node pool with the + // specified shape. If one with the same name already exists, it is + // verified against all specified fields. If a field differs, the + // virtual cluster creation will fail. + // + // If omitted, any node pool with the specified name is used. If a + // node pool with the specified name does not exist, Dataproc create a + // node pool with default values. + // + // This is an input only field. It will not be returned by the API. + GkeNodePoolConfig node_pool_config = 3 + [(google.api.field_behavior) = INPUT_ONLY]; +} + +// The configuration of a GKE node pool used by a [Dataproc-on-GKE +// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). +message GkeNodePoolConfig { + // Parameters that describe cluster nodes. + message GkeNodeConfig { + // Optional. The name of a Compute Engine [machine + // type](https://cloud.google.com/compute/docs/machine-types). + string machine_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The number of local SSD disks to attach to the node, which is + // limited by the maximum number of disks allowable per zone (see [Adding + // Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)). + int32 local_ssd_count = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the nodes are created as legacy [preemptible VM + // instances] (https://cloud.google.com/compute/docs/instances/preemptible). + // Also see + // [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot] + // VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot + // preemptible nodes cannot be used in a node pool with the `CONTROLLER` + // [role] + // (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role) + // or in the DEFAULT node pool if the CONTROLLER role is not assigned (the + // DEFAULT node pool will assume the CONTROLLER role). + bool preemptible = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of [hardware + // accelerators](https://cloud.google.com/compute/docs/gpus) to attach to + // each node. + repeated GkeNodePoolAcceleratorConfig accelerators = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. [Minimum CPU + // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) + // to be used by this instance. The instance may be scheduled on the + // specified or a newer CPU platform. Specify the friendly names of CPU + // platforms, such as "Intel Haswell"` or Intel Sandy Bridge". + string min_cpu_platform = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [Customer Managed Encryption Key (CMEK)] + // (https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek) + // used to encrypt the boot disk attached to each node in the node pool. + // Specify the key using the following format: + // projects/KEY_PROJECT_ID/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME. + string boot_disk_kms_key = 23 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the nodes are created as [Spot VM instances] + // (https://cloud.google.com/compute/docs/instances/spot). + // Spot VMs are the latest update to legacy + // [preemptible + // VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]. + // Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible + // nodes cannot be used in a node pool with the `CONTROLLER` + // [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role) + // or in the DEFAULT node pool if the CONTROLLER role is not assigned (the + // DEFAULT node pool will assume the CONTROLLER role). + bool spot = 32 [(google.api.field_behavior) = OPTIONAL]; + } + + // A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request + // for a node pool. + message GkeNodePoolAcceleratorConfig { + // The number of accelerator cards exposed to an instance. + int64 accelerator_count = 1; + + // The accelerator type resource namename (see GPUs on Compute Engine). + string accelerator_type = 2; + + // Size of partitions to create on the GPU. Valid values are described in + // the NVIDIA [mig user + // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). + string gpu_partition_size = 3; + } + + // GkeNodePoolAutoscaling contains information the cluster autoscaler needs to + // adjust the size of the node pool to the current cluster usage. + message GkeNodePoolAutoscalingConfig { + // The minimum number of nodes in the node pool. Must be >= 0 and <= + // max_node_count. + int32 min_node_count = 2; + + // The maximum number of nodes in the node pool. Must be >= min_node_count, + // and must be > 0. + // **Note:** Quota must be sufficient to scale up the cluster. + int32 max_node_count = 3; + } + + // Optional. The node pool configuration. + GkeNodeConfig config = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of Compute Engine + // [zones](https://cloud.google.com/compute/docs/zones#available) where + // node pool nodes associated with a Dataproc on GKE virtual cluster + // will be located. + // + // **Note:** All node pools associated with a virtual cluster + // must be located in the same region as the virtual cluster, and they must + // be located in the same zone within that region. + // + // If a location is not specified during node pool creation, Dataproc on GKE + // will choose the zone. + repeated string locations = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The autoscaler configuration for this node pool. The autoscaler + // is enabled only when a valid configuration is present. + GkeNodePoolAutoscalingConfig autoscaling = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Cluster components that can be activated. +enum Component { + // Unspecified component. Specifying this will cause Cluster creation to fail. + COMPONENT_UNSPECIFIED = 0; + + // The Anaconda python distribution. The Anaconda component is not supported + // in the Dataproc + // 2.0 + // image. The 2.0 image is pre-installed with Miniconda. + ANACONDA = 5; + + // Docker + DOCKER = 13; + + // The Druid query engine. (alpha) + DRUID = 9; + + // Flink + FLINK = 14; + + // HBase. (beta) + HBASE = 11; + + // The Hive Web HCatalog (the REST service for accessing HCatalog). + HIVE_WEBHCAT = 3; + + // Hudi. + HUDI = 18; + + // The Jupyter Notebook. + JUPYTER = 1; + + // The Presto query engine. + PRESTO = 6; + + // The Trino query engine. + TRINO = 17; + + // The Ranger service. + RANGER = 12; + + // The Solr service. + SOLR = 10; + + // The Zeppelin notebook. + ZEPPELIN = 4; + + // The Zookeeper service. + ZOOKEEPER = 8; +} + +// Actions in response to failure of a resource associated with a cluster. +enum FailureAction { + // When FailureAction is unspecified, failure action defaults to NO_ACTION. + FAILURE_ACTION_UNSPECIFIED = 0; + + // Take no action on failure to create a cluster resource. NO_ACTION is the + // default. + NO_ACTION = 1; + + // Delete the failed cluster resource. + DELETE = 2; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto new file mode 100644 index 000000000000..bb6a639a095e --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto @@ -0,0 +1,836 @@ +// 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.dataproc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dataproc/v1/clusters.proto"; +import "google/cloud/dataproc/v1/jobs.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; +option java_multiple_files = true; +option java_outer_classname = "WorkflowTemplatesProto"; +option java_package = "com.google.cloud.dataproc.v1"; + +// The API interface for managing Workflow Templates in the +// Dataproc API. +service WorkflowTemplateService { + option (google.api.default_host) = "dataproc.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates new workflow template. + rpc CreateWorkflowTemplate(CreateWorkflowTemplateRequest) + returns (WorkflowTemplate) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workflowTemplates" + body: "template" + additional_bindings { + post: "/v1/{parent=projects/*/regions/*}/workflowTemplates" + body: "template" + } + }; + option (google.api.method_signature) = "parent,template"; + } + + // Retrieves the latest workflow template. + // + // Can retrieve previously instantiated template by specifying optional + // version parameter. + rpc GetWorkflowTemplate(GetWorkflowTemplateRequest) + returns (WorkflowTemplate) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workflowTemplates/*}" + additional_bindings { + get: "/v1/{name=projects/*/regions/*/workflowTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Instantiates a template and begins execution. + // + // The returned Operation can be used to track execution of + // workflow by polling + // [operations.get][google.longrunning.Operations.GetOperation]. + // The Operation will complete when entire workflow is finished. + // + // The running workflow can be aborted via + // [operations.cancel][google.longrunning.Operations.CancelOperation]. + // This will cause any inflight jobs to be cancelled and workflow-owned + // clusters to be deleted. + // + // The [Operation.metadata][google.longrunning.Operation.metadata] will be + // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). + // Also see [Using + // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). + // + // On successful completion, + // [Operation.response][google.longrunning.Operation.response] will be + // [Empty][google.protobuf.Empty]. + rpc InstantiateWorkflowTemplate(InstantiateWorkflowTemplateRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workflowTemplates/*}:instantiate" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/regions/*/workflowTemplates/*}:instantiate" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,parameters"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "WorkflowMetadata" + }; + } + + // Instantiates a template and begins execution. + // + // This method is equivalent to executing the sequence + // [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], + // [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], + // [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. + // + // The returned Operation can be used to track execution of + // workflow by polling + // [operations.get][google.longrunning.Operations.GetOperation]. + // The Operation will complete when entire workflow is finished. + // + // The running workflow can be aborted via + // [operations.cancel][google.longrunning.Operations.CancelOperation]. + // This will cause any inflight jobs to be cancelled and workflow-owned + // clusters to be deleted. + // + // The [Operation.metadata][google.longrunning.Operation.metadata] will be + // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). + // Also see [Using + // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). + // + // On successful completion, + // [Operation.response][google.longrunning.Operation.response] will be + // [Empty][google.protobuf.Empty]. + rpc InstantiateInlineWorkflowTemplate( + InstantiateInlineWorkflowTemplateRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workflowTemplates:instantiateInline" + body: "template" + additional_bindings { + post: "/v1/{parent=projects/*/regions/*}/workflowTemplates:instantiateInline" + body: "template" + } + }; + option (google.api.method_signature) = "parent,template"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "WorkflowMetadata" + }; + } + + // Updates (replaces) workflow template. The updated template + // must contain version that matches the current server version. + rpc UpdateWorkflowTemplate(UpdateWorkflowTemplateRequest) + returns (WorkflowTemplate) { + option (google.api.http) = { + put: "/v1/{template.name=projects/*/locations/*/workflowTemplates/*}" + body: "template" + additional_bindings { + put: "/v1/{template.name=projects/*/regions/*/workflowTemplates/*}" + body: "template" + } + }; + option (google.api.method_signature) = "template"; + } + + // Lists workflows that match the specified filter in the request. + rpc ListWorkflowTemplates(ListWorkflowTemplatesRequest) + returns (ListWorkflowTemplatesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workflowTemplates" + additional_bindings { + get: "/v1/{parent=projects/*/regions/*}/workflowTemplates" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a workflow template. It does not cancel in-progress workflows. + rpc DeleteWorkflowTemplate(DeleteWorkflowTemplateRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workflowTemplates/*}" + additional_bindings { + delete: "/v1/{name=projects/*/regions/*/workflowTemplates/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// A Dataproc workflow template resource. +message WorkflowTemplate { + option (google.api.resource) = { + type: "dataproc.googleapis.com/WorkflowTemplate" + pattern: "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}" + pattern: "projects/{project}/locations/{location}/workflowTemplates/{workflow_template}" + history: ORIGINALLY_SINGLE_PATTERN + }; + + string id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The resource name of the workflow template, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates`, the resource name of the + // template has the following format: + // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + // + // * For `projects.locations.workflowTemplates`, the resource name of the + // template has the following format: + // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Used to perform a consistent read-modify-write. + // + // This field should be left blank for a `CreateWorkflowTemplate` request. It + // is required for an `UpdateWorkflowTemplate` request, and must match the + // current server version. A typical update template flow would fetch the + // current template with a `GetWorkflowTemplate` request, which will return + // the current template with the `version` field filled in with the + // current server version. The user updates other fields in the template, + // then returns it as part of the `UpdateWorkflowTemplate` request. + int32 version = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time template was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time template was last updated. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The labels to associate with this template. These labels + // will be propagated to all jobs and clusters created by the workflow + // instance. + // + // Label **keys** must contain 1 to 63 characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // + // Label **values** may be empty, but, if present, must contain 1 to 63 + // characters, and must conform to + // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). + // + // No more than 32 labels can be associated with a template. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Required. WorkflowTemplate scheduling information. + WorkflowTemplatePlacement placement = 7 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The Directed Acyclic Graph of Jobs to submit. + repeated OrderedJob jobs = 8 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Template parameters whose values are substituted into the + // template. Values for parameters must be provided when the template is + // instantiated. + repeated TemplateParameter parameters = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Timeout duration for the DAG of jobs, expressed in seconds (see + // [JSON representation of + // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + // The timeout duration must be from 10 minutes ("600s") to 24 hours + // ("86400s"). The timer begins when the first job is submitted. If the + // workflow is running at the end of the timeout period, any remaining jobs + // are cancelled, the workflow is ended, and if the workflow was running on a + // [managed + // cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster), + // the cluster is deleted. + google.protobuf.Duration dag_timeout = 10 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Specifies workflow execution target. +// +// Either `managed_cluster` or `cluster_selector` is required. +message WorkflowTemplatePlacement { + // Required. Specifies where workflow executes; either on a managed + // cluster or an existing cluster chosen by labels. + oneof placement { + // A cluster that is managed by the workflow. + ManagedCluster managed_cluster = 1; + + // Optional. A selector that chooses target cluster for jobs based + // on metadata. + // + // The selector is evaluated at the time each job is submitted. + ClusterSelector cluster_selector = 2; + } +} + +// Cluster that is managed by the workflow. +message ManagedCluster { + // Required. The cluster name prefix. A unique cluster name will be formed by + // appending a random suffix. + // + // The name must contain only lower-case letters (a-z), numbers (0-9), + // and hyphens (-). Must begin with a letter. Cannot begin or end with + // hyphen. Must consist of between 2 and 35 characters. + string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster configuration. + ClusterConfig config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The labels to associate with this cluster. + // + // Label keys must be between 1 and 63 characters long, and must conform to + // the following PCRE regular expression: + // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} + // + // Label values must be between 1 and 63 characters long, and must conform to + // the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + // + // No more than 32 labels can be associated with a given cluster. + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// A selector that chooses target cluster for jobs based on metadata. +message ClusterSelector { + // Optional. The zone where workflow process executes. This parameter does not + // affect the selection of the cluster. + // + // If unspecified, the zone of the first cluster matching the selector + // is used. + string zone = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The cluster labels. Cluster must have all labels + // to match. + map cluster_labels = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// A job executed by the workflow. +message OrderedJob { + // Required. The step id. The id must be unique among all jobs + // within the template. + // + // The step id is used as prefix for job id, as job + // `goog-dataproc-workflow-step-id` label, and in + // [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids] + // field from other steps. + // + // The id must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). Cannot begin or end with underscore + // or hyphen. Must consist of between 3 and 50 characters. + string step_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The job definition. + oneof job_type { + // Optional. Job is a Hadoop job. + HadoopJob hadoop_job = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Spark job. + SparkJob spark_job = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a PySpark job. + PySparkJob pyspark_job = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Hive job. + HiveJob hive_job = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Pig job. + PigJob pig_job = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a SparkR job. + SparkRJob spark_r_job = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a SparkSql job. + SparkSqlJob spark_sql_job = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job is a Presto job. + PrestoJob presto_job = 12 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The labels to associate with this job. + // + // Label keys must be between 1 and 63 characters long, and must conform to + // the following regular expression: + // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} + // + // Label values must be between 1 and 63 characters long, and must conform to + // the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + // + // No more than 32 labels can be associated with a given job. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Job scheduling configuration. + JobScheduling scheduling = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The optional list of prerequisite job step_ids. + // If not specified, the job will start at the beginning of workflow. + repeated string prerequisite_step_ids = 10 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A configurable parameter that replaces one or more fields in the template. +// Parameterizable fields: +// - Labels +// - File uris +// - Job properties +// - Job arguments +// - Script variables +// - Main class (in HadoopJob and SparkJob) +// - Zone (in ClusterSelector) +message TemplateParameter { + // Required. Parameter name. + // The parameter name is used as the key, and paired with the + // parameter value, which are passed to the template when the template + // is instantiated. + // The name must contain only capital letters (A-Z), numbers (0-9), and + // underscores (_), and must not start with a number. The maximum length is + // 40 characters. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Paths to all fields that the parameter replaces. + // A field is allowed to appear in at most one parameter's list of field + // paths. + // + // A field path is similar in syntax to a + // [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a + // field path that references the zone field of a workflow template's cluster + // selector would be specified as `placement.clusterSelector.zone`. + // + // Also, field paths can reference fields using the following syntax: + // + // * Values in maps can be referenced by key: + // * labels['key'] + // * placement.clusterSelector.clusterLabels['key'] + // * placement.managedCluster.labels['key'] + // * placement.clusterSelector.clusterLabels['key'] + // * jobs['step-id'].labels['key'] + // + // * Jobs in the jobs list can be referenced by step-id: + // * jobs['step-id'].hadoopJob.mainJarFileUri + // * jobs['step-id'].hiveJob.queryFileUri + // * jobs['step-id'].pySparkJob.mainPythonFileUri + // * jobs['step-id'].hadoopJob.jarFileUris[0] + // * jobs['step-id'].hadoopJob.archiveUris[0] + // * jobs['step-id'].hadoopJob.fileUris[0] + // * jobs['step-id'].pySparkJob.pythonFileUris[0] + // + // * Items in repeated fields can be referenced by a zero-based index: + // * jobs['step-id'].sparkJob.args[0] + // + // * Other examples: + // * jobs['step-id'].hadoopJob.properties['key'] + // * jobs['step-id'].hadoopJob.args[0] + // * jobs['step-id'].hiveJob.scriptVariables['key'] + // * jobs['step-id'].hadoopJob.mainJarFileUri + // * placement.clusterSelector.zone + // + // It may not be possible to parameterize maps and repeated fields in their + // entirety since only individual map values and individual items in repeated + // fields can be referenced. For example, the following field paths are + // invalid: + // + // - placement.clusterSelector.clusterLabels + // - jobs['step-id'].sparkJob.args + repeated string fields = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Brief description of the parameter. + // Must not exceed 1024 characters. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Validation rules to be applied to this parameter's value. + ParameterValidation validation = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for parameter validation. +message ParameterValidation { + // Required. The type of validation to be performed. + oneof validation_type { + // Validation based on regular expressions. + RegexValidation regex = 1; + + // Validation based on a list of allowed values. + ValueValidation values = 2; + } +} + +// Validation based on regular expressions. +message RegexValidation { + // Required. RE2 regular expressions used to validate the parameter's value. + // The value must match the regex in its entirety (substring + // matches are not sufficient). + repeated string regexes = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Validation based on a list of allowed values. +message ValueValidation { + // Required. List of allowed values for the parameter. + repeated string values = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A Dataproc workflow template resource. +message WorkflowMetadata { + // The operation state. + enum State { + // Unused. + UNKNOWN = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation is done; either cancelled or completed. + DONE = 3; + } + + // Output only. The resource name of the workflow template as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates`, the resource name of the + // template has the following format: + // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + // + // * For `projects.locations.workflowTemplates`, the resource name of the + // template has the following format: + // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + string template = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The version of template at the time of + // workflow instantiation. + int32 version = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create cluster operation metadata. + ClusterOperation create_cluster = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The workflow graph. + WorkflowGraph graph = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The delete cluster operation metadata. + ClusterOperation delete_cluster = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The workflow state. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the target cluster. + string cluster_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Map from parameter names to values that were used for those parameters. + map parameters = 8; + + // Output only. Workflow start time. + google.protobuf.Timestamp start_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Workflow end time. + google.protobuf.Timestamp end_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The UUID of target cluster. + string cluster_uuid = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timeout duration for the DAG of jobs, expressed in seconds + // (see [JSON representation of + // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + google.protobuf.Duration dag_timeout = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. DAG start time, only set for workflows with + // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when + // DAG begins. + google.protobuf.Timestamp dag_start_time = 13 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. DAG end time, only set for workflows with + // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when + // DAG ends. + google.protobuf.Timestamp dag_end_time = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The cluster operation triggered by a workflow. +message ClusterOperation { + // Output only. The id of the cluster operation. + string operation_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Error, if operation failed. + string error = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates the operation is done. + bool done = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The workflow graph. +message WorkflowGraph { + // Output only. The workflow nodes. + repeated WorkflowNode nodes = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The workflow node. +message WorkflowNode { + // The workflow node state. + enum NodeState { + // State is unspecified. + NODE_STATE_UNSPECIFIED = 0; + + // The node is awaiting prerequisite node to finish. + BLOCKED = 1; + + // The node is runnable but not running. + RUNNABLE = 2; + + // The node is running. + RUNNING = 3; + + // The node completed successfully. + COMPLETED = 4; + + // The node failed. A node can be marked FAILED because + // its ancestor or peer failed. + FAILED = 5; + } + + // Output only. The name of the node. + string step_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Node's prerequisite nodes. + repeated string prerequisite_step_ids = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The job id; populated after the node enters RUNNING state. + string job_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The node state. + NodeState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error detail. + string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request to create a workflow template. +message CreateWorkflowTemplateRequest { + // Required. The resource name of the region or location, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates.create`, the resource name of the + // region has the following format: + // `projects/{project_id}/regions/{region}` + // + // * For `projects.locations.workflowTemplates.create`, the resource name of + // the location has the following format: + // `projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Required. The Dataproc workflow template to create. + WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to fetch a workflow template. +message GetWorkflowTemplateRequest { + // Required. The resource name of the workflow template, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates.get`, the resource name of the + // template has the following format: + // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + // + // * For `projects.locations.workflowTemplates.get`, the resource name of the + // template has the following format: + // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Optional. The version of workflow template to retrieve. Only previously + // instantiated versions can be retrieved. + // + // If unspecified, retrieves the current version. + int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to instantiate a workflow template. +message InstantiateWorkflowTemplateRequest { + // Required. The resource name of the workflow template, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates.instantiate`, the resource name + // of the template has the following format: + // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + // + // * For `projects.locations.workflowTemplates.instantiate`, the resource name + // of the template has the following format: + // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Optional. The version of workflow template to instantiate. If specified, + // the workflow will be instantiated only if the current version of + // the workflow template has the supplied version. + // + // This option cannot be used to instantiate a previous version of + // workflow template. + int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A tag that prevents multiple concurrent workflow + // instances with the same tag from running. This mitigates risk of + // concurrent instances started due to retries. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The tag must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Map from parameter names to values that should be used for those + // parameters. Values may not exceed 1000 characters. + map parameters = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to instantiate an inline workflow template. +message InstantiateInlineWorkflowTemplateRequest { + // Required. The resource name of the region or location, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates,instantiateinline`, the resource + // name of the region has the following format: + // `projects/{project_id}/regions/{region}` + // + // * For `projects.locations.workflowTemplates.instantiateinline`, the + // resource name of the location has the following format: + // `projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Required. The workflow template to instantiate. + WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A tag that prevents multiple concurrent workflow + // instances with the same tag from running. This mitigates risk of + // concurrent instances started due to retries. + // + // It is recommended to always set this value to a + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + // + // The tag must contain only letters (a-z, A-Z), numbers (0-9), + // underscores (_), and hyphens (-). The maximum length is 40 characters. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request to update a workflow template. +message UpdateWorkflowTemplateRequest { + // Required. The updated workflow template. + // + // The `template.version` field must match the current version. + WorkflowTemplate template = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A request to list workflow templates in a project. +message ListWorkflowTemplatesRequest { + // Required. The resource name of the region or location, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates,list`, the resource + // name of the region has the following format: + // `projects/{project_id}/regions/{region}` + // + // * For `projects.locations.workflowTemplates.list`, the + // resource name of the location has the following format: + // `projects/{project_id}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Optional. The maximum number of results to return in each response. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page token, returned by a previous call, to request the + // next page of results. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A response to a request to list workflow templates in a project. +message ListWorkflowTemplatesResponse { + // Output only. WorkflowTemplates list. + repeated WorkflowTemplate templates = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This token is included in the response if there are more + // results to fetch. To fetch additional results, provide this value as the + // page_token in a subsequent ListWorkflowTemplatesRequest. + string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request to delete a workflow template. +// +// Currently started workflows will remain running. +message DeleteWorkflowTemplateRequest { + // Required. The resource name of the workflow template, as described + // in https://cloud.google.com/apis/design/resource_names. + // + // * For `projects.regions.workflowTemplates.delete`, the resource name + // of the template has the following format: + // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + // + // * For `projects.locations.workflowTemplates.instantiate`, the resource name + // of the template has the following format: + // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dataproc.googleapis.com/WorkflowTemplate" + } + ]; + + // Optional. The version of workflow template to delete. If specified, + // will only delete the template if the current server version matches + // specified version. + int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js new file mode 100644 index 000000000000..ee5ff1ec06b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js @@ -0,0 +1,73 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, policy) { + // [START dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.autoscalingPolicies.create`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * * For `projects.locations.autoscalingPolicies.create`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. The autoscaling policy to create. + */ + // const policy = {} + + // Imports the Dataproc library + const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new AutoscalingPolicyServiceClient(); + + async function callCreateAutoscalingPolicy() { + // Construct request + const request = { + parent, + policy, + }; + + // Run request + const response = await dataprocClient.createAutoscalingPolicy(request); + console.log(response); + } + + callCreateAutoscalingPolicy(); + // [END dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js new file mode 100644 index 000000000000..029515322c03 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js @@ -0,0 +1,68 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The "resource name" of the autoscaling policy, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.autoscalingPolicies.delete`, the resource name + * of the policy has the following format: + * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + * * For `projects.locations.autoscalingPolicies.delete`, the resource name + * of the policy has the following format: + * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + */ + // const name = 'abc123' + + // Imports the Dataproc library + const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new AutoscalingPolicyServiceClient(); + + async function callDeleteAutoscalingPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.deleteAutoscalingPolicy(request); + console.log(response); + } + + callDeleteAutoscalingPolicy(); + // [END dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js new file mode 100644 index 000000000000..91ed92b26a0b --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js @@ -0,0 +1,68 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The "resource name" of the autoscaling policy, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.autoscalingPolicies.get`, the resource name + * of the policy has the following format: + * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + * * For `projects.locations.autoscalingPolicies.get`, the resource name + * of the policy has the following format: + * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + */ + // const name = 'abc123' + + // Imports the Dataproc library + const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new AutoscalingPolicyServiceClient(); + + async function callGetAutoscalingPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.getAutoscalingPolicy(request); + console.log(response); + } + + callGetAutoscalingPolicy(); + // [END dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js new file mode 100644 index 000000000000..690c60477e44 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.autoscalingPolicies.list`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * * For `projects.locations.autoscalingPolicies.list`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of results to return in each response. + * Must be less than or equal to 1000. Defaults to 100. + */ + // const pageSize = 1234 + /** + * Optional. The page token, returned by a previous call, to request the + * next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Dataproc library + const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new AutoscalingPolicyServiceClient(); + + async function callListAutoscalingPolicies() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dataprocClient.listAutoscalingPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAutoscalingPolicies(); + // [END dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js new file mode 100644 index 000000000000..a506990a3cdf --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(policy) { + // [START dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_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 updated autoscaling policy. + */ + // const policy = {} + + // Imports the Dataproc library + const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new AutoscalingPolicyServiceClient(); + + async function callUpdateAutoscalingPolicy() { + // Construct request + const request = { + policy, + }; + + // Run request + const response = await dataprocClient.updateAutoscalingPolicy(request); + console.log(response); + } + + callUpdateAutoscalingPolicy(); + // [END dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js new file mode 100644 index 000000000000..e54566d6c157 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, batch) { + // [START dataproc_v1_generated_BatchController_CreateBatch_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this batch will be created. + */ + // const parent = 'abc123' + /** + * Required. The batch to create. + */ + // const batch = {} + /** + * Optional. The ID to use for the batch, which will become the final + * component of the batch's resource name. + * This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`. + */ + // const batchId = 'abc123' + /** + * Optional. A unique ID used to identify the request. If the service + * receives two + * CreateBatchRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s + * with the same request_id, the second request is ignored and the + * Operation that corresponds to the first Batch created and stored + * in the backend is returned. + * Recommendation: Set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The value must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {BatchControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new BatchControllerClient(); + + async function callCreateBatch() { + // Construct request + const request = { + parent, + batch, + }; + + // Run request + const [operation] = await dataprocClient.createBatch(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBatch(); + // [END dataproc_v1_generated_BatchController_CreateBatch_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-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js new file mode 100644 index 000000000000..7e59ec86a284 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js @@ -0,0 +1,63 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_BatchController_DeleteBatch_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 fully qualified name of the batch to retrieve + * in the format + * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + */ + // const name = 'abc123' + + // Imports the Dataproc library + const {BatchControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new BatchControllerClient(); + + async function callDeleteBatch() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.deleteBatch(request); + console.log(response); + } + + callDeleteBatch(); + // [END dataproc_v1_generated_BatchController_DeleteBatch_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-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js new file mode 100644 index 000000000000..c1fe0b00cd88 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js @@ -0,0 +1,63 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_BatchController_GetBatch_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 fully qualified name of the batch to retrieve + * in the format + * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + */ + // const name = 'abc123' + + // Imports the Dataproc library + const {BatchControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new BatchControllerClient(); + + async function callGetBatch() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.getBatch(request); + console.log(response); + } + + callGetBatch(); + // [END dataproc_v1_generated_BatchController_GetBatch_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-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js new file mode 100644 index 000000000000..74ef83b17c99 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js @@ -0,0 +1,93 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START dataproc_v1_generated_BatchController_ListBatches_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of batches. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of batches to return in each response. + * The service may return fewer than this value. + * The default page size is 20; the maximum page size is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token received from a previous `ListBatches` call. + * Provide this token to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter for the batches to return in the response. + * A filter is a logical expression constraining the values of various fields + * in each batch resource. Filters are case sensitive, and may contain + * multiple clauses combined with logical operators (AND/OR). + * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. + * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` + * filters for batches in state RUNNING that were created before 2023-01-01 + * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + * description of the filter syntax and a list of supported comparisons. + */ + // const filter = 'abc123' + /** + * Optional. Field(s) on which to sort the list of batches. + * Currently the only supported sort orders are unspecified (empty) and + * `create_time desc` to sort by most recently created batches first. + * See https://google.aip.dev/132#ordering for more details. + */ + // const orderBy = 'abc123' + + // Imports the Dataproc library + const {BatchControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new BatchControllerClient(); + + async function callListBatches() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dataprocClient.listBatchesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBatches(); + // [END dataproc_v1_generated_BatchController_ListBatches_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-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js new file mode 100644 index 000000000000..c14ef7388c71 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js @@ -0,0 +1,90 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, cluster) { + // [START dataproc_v1_generated_ClusterController_CreateCluster_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 ID of the Google Cloud Platform project that the cluster + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster to create. + */ + // const cluster = {} + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s + * with the same id, then the second request will be ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + /** + * Optional. Failure action when primary worker creation fails. + */ + // const actionOnFailedPrimaryWorkers = {} + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callCreateCluster() { + // Construct request + const request = { + projectId, + region, + cluster, + }; + + // Run request + const [operation] = await dataprocClient.createCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCluster(); + // [END dataproc_v1_generated_ClusterController_CreateCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js new file mode 100644 index 000000000000..408dbe356cad --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js @@ -0,0 +1,91 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName) { + // [START dataproc_v1_generated_ClusterController_DeleteCluster_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 ID of the Google Cloud Platform project that the cluster + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + /** + * Optional. Specifying the `cluster_uuid` means the RPC should fail + * (with error NOT_FOUND) if cluster with specified UUID does not exist. + */ + // const clusterUuid = 'abc123' + /** + * Optional. A unique ID used to identify the request. If the server + * receives two + * DeleteClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s + * with the same id, then the second request will be ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callDeleteCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + }; + + // Run request + const [operation] = await dataprocClient.deleteCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteCluster(); + // [END dataproc_v1_generated_ClusterController_DeleteCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js new file mode 100644 index 000000000000..78bbe9e700dd --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js @@ -0,0 +1,94 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName) { + // [START dataproc_v1_generated_ClusterController_DiagnoseCluster_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 ID of the Google Cloud Platform project that the cluster + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + /** + * Optional. The output Cloud Storage directory for the diagnostic + * tarball. If not specified, a task-specific directory in the cluster's + * staging bucket will be used. + */ + // const tarballGcsDir = 'abc123' + /** + * Optional. Time interval in which diagnosis should be carried out on the + * cluster. + */ + // const diagnosisInterval = {} + /** + * Optional. Specifies a list of jobs on which diagnosis is to be performed. + * Format: projects/{project}/regions/{region}/jobs/{job} + */ + // const jobs = ['abc','def'] + /** + * Optional. Specifies a list of yarn applications on which diagnosis is to be + * performed. + */ + // const yarnApplicationIds = ['abc','def'] + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callDiagnoseCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + }; + + // Run request + const [operation] = await dataprocClient.diagnoseCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDiagnoseCluster(); + // [END dataproc_v1_generated_ClusterController_DiagnoseCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js new file mode 100644 index 000000000000..81b9a730c32e --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js @@ -0,0 +1,72 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName) { + // [START dataproc_v1_generated_ClusterController_GetCluster_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 ID of the Google Cloud Platform project that the cluster + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callGetCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + }; + + // Run request + const response = await dataprocClient.getCluster(request); + console.log(response); + } + + callGetCluster(); + // [END dataproc_v1_generated_ClusterController_GetCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js new file mode 100644 index 000000000000..1159de5a403a --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js @@ -0,0 +1,95 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region) { + // [START dataproc_v1_generated_ClusterController_ListClusters_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 ID of the Google Cloud Platform project that the cluster + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Optional. A filter constraining the clusters to list. Filters are + * case-sensitive and have the following syntax: + * field = value AND field = value ... + * where **field** is one of `status.state`, `clusterName`, or `labels.KEY`, + * and `[KEY]` is a label key. **value** can be `*` to match all values. + * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, + * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` + * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` + * contains the `DELETING` and `ERROR` states. + * `clusterName` is the name of the cluster provided at creation time. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * Example filter: + * status.state = ACTIVE AND clusterName = mycluster + * AND labels.env = staging AND labels.starred = * + */ + // const filter = 'abc123' + /** + * Optional. The standard List page size. + */ + // const pageSize = 1234 + /** + * Optional. The standard List page token. + */ + // const pageToken = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callListClusters() { + // Construct request + const request = { + projectId, + region, + }; + + // Run request + const iterable = await dataprocClient.listClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListClusters(); + // [END dataproc_v1_generated_ClusterController_ListClusters_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-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js new file mode 100644 index 000000000000..53742e7ef1f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js @@ -0,0 +1,91 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName) { + // [START dataproc_v1_generated_ClusterController_StartCluster_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 ID of the Google Cloud Platform project the + * cluster belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + /** + * Optional. Specifying the `cluster_uuid` means the RPC will fail + * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + */ + // const clusterUuid = 'abc123' + /** + * Optional. A unique ID used to identify the request. If the server + * receives two + * StartClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s + * with the same id, then the second request will be ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callStartCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + }; + + // Run request + const [operation] = await dataprocClient.startCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartCluster(); + // [END dataproc_v1_generated_ClusterController_StartCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js new file mode 100644 index 000000000000..95679fabd3f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js @@ -0,0 +1,91 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName) { + // [START dataproc_v1_generated_ClusterController_StopCluster_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 ID of the Google Cloud Platform project the + * cluster belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + /** + * Optional. Specifying the `cluster_uuid` means the RPC will fail + * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + */ + // const clusterUuid = 'abc123' + /** + * Optional. A unique ID used to identify the request. If the server + * receives two + * StopClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s + * with the same id, then the second request will be ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callStopCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + }; + + // Run request + const [operation] = await dataprocClient.stopCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopCluster(); + // [END dataproc_v1_generated_ClusterController_StopCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js new file mode 100644 index 000000000000..8a82e0b600f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js @@ -0,0 +1,154 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, clusterName, cluster, updateMask) { + // [START dataproc_v1_generated_ClusterController_UpdateCluster_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 ID of the Google Cloud Platform project the + * cluster belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The cluster name. + */ + // const clusterName = 'abc123' + /** + * Required. The changes to the cluster. + */ + // const cluster = {} + /** + * Optional. Timeout for graceful YARN decommissioning. Graceful + * decommissioning allows removing nodes from the cluster without + * interrupting jobs in progress. Timeout specifies how long to wait for jobs + * in progress to finish before forcefully removing nodes (and potentially + * interrupting jobs). Default timeout is 0 (for forceful decommission), and + * the maximum allowed timeout is 1 day. (see JSON representation of + * Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + */ + // const gracefulDecommissionTimeout = {} + /** + * Required. Specifies the path, relative to `Cluster`, of + * the field to update. For example, to change the number of workers + * in a cluster to 5, the `update_mask` parameter would be + * specified as `config.worker_config.num_instances`, + * and the `PATCH` request body would specify the new value, as follows: + * { + * "config":{ + * "workerConfig":{ + * "numInstances":"5" + * } + * } + * } + * Similarly, to change the number of preemptible workers in a cluster to 5, + * the `update_mask` parameter would be + * `config.secondary_worker_config.num_instances`, and the `PATCH` request + * body would be set as follows: + * { + * "config":{ + * "secondaryWorkerConfig":{ + * "numInstances":"5" + * } + * } + * } + * Note: Currently, only the following fields can be updated: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or + * change autoscaling policies
+ */ + // const updateMask = {} + /** + * Optional. A unique ID used to identify the request. If the server + * receives two + * UpdateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s + * with the same id, then the second request will be ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new ClusterControllerClient(); + + async function callUpdateCluster() { + // Construct request + const request = { + projectId, + region, + clusterName, + cluster, + updateMask, + }; + + // Run request + const [operation] = await dataprocClient.updateCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCluster(); + // [END dataproc_v1_generated_ClusterController_UpdateCluster_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-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js new file mode 100644 index 000000000000..4f6219a3e3e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js @@ -0,0 +1,72 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, jobId) { + // [START dataproc_v1_generated_JobController_CancelJob_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job ID. + */ + // const jobId = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callCancelJob() { + // Construct request + const request = { + projectId, + region, + jobId, + }; + + // Run request + const response = await dataprocClient.cancelJob(request); + console.log(response); + } + + callCancelJob(); + // [END dataproc_v1_generated_JobController_CancelJob_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-dataproc/v1/samples/generated/v1/job_controller.delete_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js new file mode 100644 index 000000000000..fd2e2d92dd6f --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js @@ -0,0 +1,72 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, jobId) { + // [START dataproc_v1_generated_JobController_DeleteJob_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job ID. + */ + // const jobId = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callDeleteJob() { + // Construct request + const request = { + projectId, + region, + jobId, + }; + + // Run request + const response = await dataprocClient.deleteJob(request); + console.log(response); + } + + callDeleteJob(); + // [END dataproc_v1_generated_JobController_DeleteJob_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-dataproc/v1/samples/generated/v1/job_controller.get_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js new file mode 100644 index 000000000000..eb284bf44722 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js @@ -0,0 +1,72 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, jobId) { + // [START dataproc_v1_generated_JobController_GetJob_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job ID. + */ + // const jobId = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callGetJob() { + // Construct request + const request = { + projectId, + region, + jobId, + }; + + // Run request + const response = await dataprocClient.getJob(request); + console.log(response); + } + + callGetJob(); + // [END dataproc_v1_generated_JobController_GetJob_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-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js new file mode 100644 index 000000000000..450e4faa272e --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js @@ -0,0 +1,102 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region) { + // [START dataproc_v1_generated_JobController_ListJobs_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Optional. The number of results to return in each response. + */ + // const pageSize = 1234 + /** + * Optional. The page token, returned by a previous call, to request the + * next page of results. + */ + // const pageToken = 'abc123' + /** + * Optional. If set, the returned jobs list includes only jobs that were + * submitted to the named cluster. + */ + // const clusterName = 'abc123' + /** + * Optional. Specifies enumerated categories of jobs to list. + * (default = match ALL jobs). + * If `filter` is provided, `jobStateMatcher` will be ignored. + */ + // const jobStateMatcher = {} + /** + * Optional. A filter constraining the jobs to list. Filters are + * case-sensitive and have the following syntax: + * field = value AND field = value ... + * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label + * key. **value** can be `*` to match all values. + * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * Example filter: + * status.state = ACTIVE AND labels.env = staging AND labels.starred = * + */ + // const filter = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callListJobs() { + // Construct request + const request = { + projectId, + region, + }; + + // Run request + const iterable = await dataprocClient.listJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobs(); + // [END dataproc_v1_generated_JobController_ListJobs_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-dataproc/v1/samples/generated/v1/job_controller.submit_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js new file mode 100644 index 000000000000..5fd939be15ab --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js @@ -0,0 +1,85 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, job) { + // [START dataproc_v1_generated_JobController_SubmitJob_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job resource. + */ + // const job = {} + /** + * Optional. A unique id used to identify the request. If the server + * receives two + * SubmitJobRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s + * with the same id, then the second request will be ignored and the + * first Job google.cloud.dataproc.v1.Job created and stored in the backend + * is returned. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The id must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callSubmitJob() { + // Construct request + const request = { + projectId, + region, + job, + }; + + // Run request + const response = await dataprocClient.submitJob(request); + console.log(response); + } + + callSubmitJob(); + // [END dataproc_v1_generated_JobController_SubmitJob_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-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js new file mode 100644 index 000000000000..fa41a1642d7d --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, job) { + // [START dataproc_v1_generated_JobController_SubmitJobAsOperation_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job resource. + */ + // const job = {} + /** + * Optional. A unique id used to identify the request. If the server + * receives two + * SubmitJobRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s + * with the same id, then the second request will be ignored and the + * first Job google.cloud.dataproc.v1.Job created and stored in the backend + * is returned. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The id must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callSubmitJobAsOperation() { + // Construct request + const request = { + projectId, + region, + job, + }; + + // Run request + const [operation] = await dataprocClient.submitJobAsOperation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSubmitJobAsOperation(); + // [END dataproc_v1_generated_JobController_SubmitJobAsOperation_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-dataproc/v1/samples/generated/v1/job_controller.update_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js new file mode 100644 index 000000000000..a9cf7e0ea854 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js @@ -0,0 +1,87 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, region, jobId, job, updateMask) { + // [START dataproc_v1_generated_JobController_UpdateJob_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 ID of the Google Cloud Platform project that the job + * belongs to. + */ + // const projectId = 'abc123' + /** + * Required. The Dataproc region in which to handle the request. + */ + // const region = 'us-central1' + /** + * Required. The job ID. + */ + // const jobId = 'abc123' + /** + * Required. The changes to the job. + */ + // const job = {} + /** + * Required. Specifies the path, relative to Job, of + * the field to update. For example, to update the labels of a Job the + * update_mask parameter would be specified as + * labels, and the `PATCH` request body would specify the new + * value. Note: Currently, labels is the only + * field that can be updated. + */ + // const updateMask = {} + + // Imports the Dataproc library + const {JobControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new JobControllerClient(); + + async function callUpdateJob() { + // Construct request + const request = { + projectId, + region, + jobId, + job, + updateMask, + }; + + // Run request + const response = await dataprocClient.updateJob(request); + console.log(response); + } + + callUpdateJob(); + // [END dataproc_v1_generated_JobController_UpdateJob_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-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js new file mode 100644 index 000000000000..330a781bd1cc --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js @@ -0,0 +1,88 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, nodeGroup) { + // [START dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + */ + // const parent = 'abc123' + /** + * Required. The node group to create. + */ + // const nodeGroup = {} + /** + * Optional. An optional node group ID. Generated if not specified. + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + */ + // const nodeGroupId = 'abc123' + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * CreateNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new NodeGroupControllerClient(); + + async function callCreateNodeGroup() { + // Construct request + const request = { + parent, + nodeGroup, + }; + + // Run request + const [operation] = await dataprocClient.createNodeGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateNodeGroup(); + // [END dataproc_v1_generated_NodeGroupController_CreateNodeGroup_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-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js new file mode 100644 index 000000000000..9ae8ae8a0ef2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js @@ -0,0 +1,63 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_NodeGroupController_GetNodeGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + */ + // const name = 'abc123' + + // Imports the Dataproc library + const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new NodeGroupControllerClient(); + + async function callGetNodeGroup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.getNodeGroup(request); + console.log(response); + } + + callGetNodeGroup(); + // [END dataproc_v1_generated_NodeGroupController_GetNodeGroup_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-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js new file mode 100644 index 000000000000..954d333b3b1b --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js @@ -0,0 +1,98 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, size) { + // [START dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + */ + // const name = 'abc123' + /** + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + */ + // const size = 1234 + /** + * Optional. A unique ID used to identify the request. If the server receives + * two + * ResizeNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first google.longrunning.Operation google.longrunning.Operation created + * and stored in the backend is returned. + * Recommendation: Set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + /** + * Optional. Timeout for graceful YARN decommissioning. Graceful + * decommissioning + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). + * Only supported on Dataproc image versions 1.2 and higher. + */ + // const gracefulDecommissionTimeout = {} + + // Imports the Dataproc library + const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new NodeGroupControllerClient(); + + async function callResizeNodeGroup() { + // Construct request + const request = { + name, + size, + }; + + // Run request + const [operation] = await dataprocClient.resizeNodeGroup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callResizeNodeGroup(); + // [END dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_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-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json new file mode 100644 index 000000000000..02bce0bdb368 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json @@ -0,0 +1,1703 @@ +{ + "clientLibrary": { + "name": "nodejs-dataproc", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.dataproc.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async", + "title": "dataproc createAutoscalingPolicy Sample", + "origin": "API_DEFINITION", + "description": " Creates new autoscaling policy.", + "canonical": true, + "file": "autoscaling_policy_service.create_autoscaling_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.CreateAutoscalingPolicy", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.cloud.dataproc.v1.AutoscalingPolicy" + } + ], + "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", + "client": { + "shortName": "AutoscalingPolicyServiceClient", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" + }, + "method": { + "shortName": "CreateAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.CreateAutoscalingPolicy", + "service": { + "shortName": "AutoscalingPolicyService", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_async", + "title": "dataproc updateAutoscalingPolicy Sample", + "origin": "API_DEFINITION", + "description": " Updates (replaces) autoscaling policy. Disabled check for update_mask, because all updates will be full replacements.", + "canonical": true, + "file": "autoscaling_policy_service.update_autoscaling_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.UpdateAutoscalingPolicy", + "async": true, + "parameters": [ + { + "name": "policy", + "type": ".google.cloud.dataproc.v1.AutoscalingPolicy" + } + ], + "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", + "client": { + "shortName": "AutoscalingPolicyServiceClient", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" + }, + "method": { + "shortName": "UpdateAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.UpdateAutoscalingPolicy", + "service": { + "shortName": "AutoscalingPolicyService", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async", + "title": "dataproc getAutoscalingPolicy Sample", + "origin": "API_DEFINITION", + "description": " Retrieves autoscaling policy.", + "canonical": true, + "file": "autoscaling_policy_service.get_autoscaling_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.GetAutoscalingPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", + "client": { + "shortName": "AutoscalingPolicyServiceClient", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" + }, + "method": { + "shortName": "GetAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.GetAutoscalingPolicy", + "service": { + "shortName": "AutoscalingPolicyService", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async", + "title": "dataproc listAutoscalingPolicies Sample", + "origin": "API_DEFINITION", + "description": " Lists autoscaling policies in the project.", + "canonical": true, + "file": "autoscaling_policy_service.list_autoscaling_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAutoscalingPolicies", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.ListAutoscalingPolicies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse", + "client": { + "shortName": "AutoscalingPolicyServiceClient", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" + }, + "method": { + "shortName": "ListAutoscalingPolicies", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.ListAutoscalingPolicies", + "service": { + "shortName": "AutoscalingPolicyService", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async", + "title": "dataproc deleteAutoscalingPolicy Sample", + "origin": "API_DEFINITION", + "description": " Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.", + "canonical": true, + "file": "autoscaling_policy_service.delete_autoscaling_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.DeleteAutoscalingPolicy", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AutoscalingPolicyServiceClient", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" + }, + "method": { + "shortName": "DeleteAutoscalingPolicy", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.DeleteAutoscalingPolicy", + "service": { + "shortName": "AutoscalingPolicyService", + "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_BatchController_CreateBatch_async", + "title": "dataproc createBatch Sample", + "origin": "API_DEFINITION", + "description": " Creates a batch workload that executes asynchronously.", + "canonical": true, + "file": "batch_controller.create_batch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.CreateBatch", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "batch", + "type": ".google.cloud.dataproc.v1.Batch" + }, + { + "name": "batch_id", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BatchControllerClient", + "fullName": "google.cloud.dataproc.v1.BatchControllerClient" + }, + "method": { + "shortName": "CreateBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.CreateBatch", + "service": { + "shortName": "BatchController", + "fullName": "google.cloud.dataproc.v1.BatchController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_BatchController_GetBatch_async", + "title": "dataproc getBatch Sample", + "origin": "API_DEFINITION", + "description": " Gets the batch workload resource representation.", + "canonical": true, + "file": "batch_controller.get_batch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.GetBatch", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.Batch", + "client": { + "shortName": "BatchControllerClient", + "fullName": "google.cloud.dataproc.v1.BatchControllerClient" + }, + "method": { + "shortName": "GetBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.GetBatch", + "service": { + "shortName": "BatchController", + "fullName": "google.cloud.dataproc.v1.BatchController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_BatchController_ListBatches_async", + "title": "dataproc listBatches Sample", + "origin": "API_DEFINITION", + "description": " Lists batch workloads.", + "canonical": true, + "file": "batch_controller.list_batches.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBatches", + "fullName": "google.cloud.dataproc.v1.BatchController.ListBatches", + "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.dataproc.v1.ListBatchesResponse", + "client": { + "shortName": "BatchControllerClient", + "fullName": "google.cloud.dataproc.v1.BatchControllerClient" + }, + "method": { + "shortName": "ListBatches", + "fullName": "google.cloud.dataproc.v1.BatchController.ListBatches", + "service": { + "shortName": "BatchController", + "fullName": "google.cloud.dataproc.v1.BatchController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_BatchController_DeleteBatch_async", + "title": "dataproc deleteBatch Sample", + "origin": "API_DEFINITION", + "description": " Deletes the batch workload resource. If the batch is not in terminal state, the delete fails and the response returns `FAILED_PRECONDITION`.", + "canonical": true, + "file": "batch_controller.delete_batch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.DeleteBatch", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BatchControllerClient", + "fullName": "google.cloud.dataproc.v1.BatchControllerClient" + }, + "method": { + "shortName": "DeleteBatch", + "fullName": "google.cloud.dataproc.v1.BatchController.DeleteBatch", + "service": { + "shortName": "BatchController", + "fullName": "google.cloud.dataproc.v1.BatchController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_CreateCluster_async", + "title": "dataproc createCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).", + "canonical": true, + "file": "cluster_controller.create_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.CreateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.cloud.dataproc.v1.Cluster" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "action_on_failed_primary_workers", + "type": ".google.cloud.dataproc.v1.FailureAction" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "CreateCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.CreateCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_UpdateCluster_async", + "title": "dataproc updateCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error is returned.", + "canonical": true, + "file": "cluster_controller.update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 146, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.UpdateCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.cloud.dataproc.v1.Cluster" + }, + { + "name": "graceful_decommission_timeout", + "type": ".google.protobuf.Duration" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "UpdateCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.UpdateCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_StopCluster_async", + "title": "dataproc stopCluster Sample", + "origin": "API_DEFINITION", + "description": " Stops a cluster in a project.", + "canonical": true, + "file": "cluster_controller.stop_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.StopCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "cluster_uuid", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "StopCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.StopCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_StartCluster_async", + "title": "dataproc startCluster Sample", + "origin": "API_DEFINITION", + "description": " Starts a cluster in a project.", + "canonical": true, + "file": "cluster_controller.start_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.StartCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "cluster_uuid", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "StartCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.StartCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_DeleteCluster_async", + "title": "dataproc deleteCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).", + "canonical": true, + "file": "cluster_controller.delete_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.DeleteCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "cluster_uuid", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "DeleteCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.DeleteCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_GetCluster_async", + "title": "dataproc getCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets the resource representation for a cluster in a project.", + "canonical": true, + "file": "cluster_controller.get_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.GetCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.Cluster", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "GetCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.GetCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_ListClusters_async", + "title": "dataproc listClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists all regions/{region}/clusters in a project alphabetically.", + "canonical": true, + "file": "cluster_controller.list_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListClusters", + "fullName": "google.cloud.dataproc.v1.ClusterController.ListClusters", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.ListClustersResponse", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "ListClusters", + "fullName": "google.cloud.dataproc.v1.ClusterController.ListClusters", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_ClusterController_DiagnoseCluster_async", + "title": "dataproc diagnoseCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets cluster diagnostic information. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, [Operation.response][google.longrunning.Operation.response] contains [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).", + "canonical": true, + "file": "cluster_controller.diagnose_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DiagnoseCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.DiagnoseCluster", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "tarball_gcs_dir", + "type": "TYPE_STRING" + }, + { + "name": "diagnosis_interval", + "type": ".google.type.Interval" + }, + { + "name": "jobs", + "type": "TYPE_STRING[]" + }, + { + "name": "yarn_application_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ClusterControllerClient", + "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" + }, + "method": { + "shortName": "DiagnoseCluster", + "fullName": "google.cloud.dataproc.v1.ClusterController.DiagnoseCluster", + "service": { + "shortName": "ClusterController", + "fullName": "google.cloud.dataproc.v1.ClusterController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_SubmitJob_async", + "title": "dataproc submitJob Sample", + "origin": "API_DEFINITION", + "description": " Submits a job to a cluster.", + "canonical": true, + "file": "job_controller.submit_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SubmitJob", + "fullName": "google.cloud.dataproc.v1.JobController.SubmitJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.cloud.dataproc.v1.Job" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.Job", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "SubmitJob", + "fullName": "google.cloud.dataproc.v1.JobController.SubmitJob", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_SubmitJobAsOperation_async", + "title": "dataproc submitJobAsOperation Sample", + "origin": "API_DEFINITION", + "description": " Submits job to a cluster.", + "canonical": true, + "file": "job_controller.submit_job_as_operation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SubmitJobAsOperation", + "fullName": "google.cloud.dataproc.v1.JobController.SubmitJobAsOperation", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.cloud.dataproc.v1.Job" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "SubmitJobAsOperation", + "fullName": "google.cloud.dataproc.v1.JobController.SubmitJobAsOperation", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_GetJob_async", + "title": "dataproc getJob Sample", + "origin": "API_DEFINITION", + "description": " Gets the resource representation for a job in a project.", + "canonical": true, + "file": "job_controller.get_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJob", + "fullName": "google.cloud.dataproc.v1.JobController.GetJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.Job", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "GetJob", + "fullName": "google.cloud.dataproc.v1.JobController.GetJob", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_ListJobs_async", + "title": "dataproc listJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists regions/{region}/jobs in a project.", + "canonical": true, + "file": "job_controller.list_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 94, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobs", + "fullName": "google.cloud.dataproc.v1.JobController.ListJobs", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "cluster_name", + "type": "TYPE_STRING" + }, + { + "name": "job_state_matcher", + "type": ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.ListJobsResponse", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "ListJobs", + "fullName": "google.cloud.dataproc.v1.JobController.ListJobs", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_UpdateJob_async", + "title": "dataproc updateJob Sample", + "origin": "API_DEFINITION", + "description": " Updates a job in a project.", + "canonical": true, + "file": "job_controller.update_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateJob", + "fullName": "google.cloud.dataproc.v1.JobController.UpdateJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.cloud.dataproc.v1.Job" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dataproc.v1.Job", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "UpdateJob", + "fullName": "google.cloud.dataproc.v1.JobController.UpdateJob", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_CancelJob_async", + "title": "dataproc cancelJob Sample", + "origin": "API_DEFINITION", + "description": " Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).", + "canonical": true, + "file": "job_controller.cancel_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelJob", + "fullName": "google.cloud.dataproc.v1.JobController.CancelJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.Job", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "CancelJob", + "fullName": "google.cloud.dataproc.v1.JobController.CancelJob", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_JobController_DeleteJob_async", + "title": "dataproc deleteJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`.", + "canonical": true, + "file": "job_controller.delete_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteJob", + "fullName": "google.cloud.dataproc.v1.JobController.DeleteJob", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "region", + "type": "TYPE_STRING" + }, + { + "name": "job_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "JobControllerClient", + "fullName": "google.cloud.dataproc.v1.JobControllerClient" + }, + "method": { + "shortName": "DeleteJob", + "fullName": "google.cloud.dataproc.v1.JobController.DeleteJob", + "service": { + "shortName": "JobController", + "fullName": "google.cloud.dataproc.v1.JobController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async", + "title": "dataproc createNodeGroup Sample", + "origin": "API_DEFINITION", + "description": " Creates a node group in a cluster. The returned [Operation.metadata][google.longrunning.Operation.metadata] is [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).", + "canonical": true, + "file": "node_group_controller.create_node_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.CreateNodeGroup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "node_group", + "type": ".google.cloud.dataproc.v1.NodeGroup" + }, + { + "name": "node_group_id", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "NodeGroupControllerClient", + "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" + }, + "method": { + "shortName": "CreateNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.CreateNodeGroup", + "service": { + "shortName": "NodeGroupController", + "fullName": "google.cloud.dataproc.v1.NodeGroupController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async", + "title": "dataproc resizeNodeGroup Sample", + "origin": "API_DEFINITION", + "description": " Resizes a node group in a cluster. The returned [Operation.metadata][google.longrunning.Operation.metadata] is [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).", + "canonical": true, + "file": "node_group_controller.resize_node_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResizeNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.ResizeNodeGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "size", + "type": "TYPE_INT32" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "graceful_decommission_timeout", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "NodeGroupControllerClient", + "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" + }, + "method": { + "shortName": "ResizeNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.ResizeNodeGroup", + "service": { + "shortName": "NodeGroupController", + "fullName": "google.cloud.dataproc.v1.NodeGroupController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_NodeGroupController_GetNodeGroup_async", + "title": "dataproc getNodeGroup Sample", + "origin": "API_DEFINITION", + "description": " Gets the resource representation for a node group in a cluster.", + "canonical": true, + "file": "node_group_controller.get_node_group.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.GetNodeGroup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.NodeGroup", + "client": { + "shortName": "NodeGroupControllerClient", + "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" + }, + "method": { + "shortName": "GetNodeGroup", + "fullName": "google.cloud.dataproc.v1.NodeGroupController.GetNodeGroup", + "service": { + "shortName": "NodeGroupController", + "fullName": "google.cloud.dataproc.v1.NodeGroupController" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async", + "title": "dataproc createWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Creates new workflow template.", + "canonical": true, + "file": "workflow_template_service.create_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "template", + "type": ".google.cloud.dataproc.v1.WorkflowTemplate" + } + ], + "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "CreateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async", + "title": "dataproc getWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the latest workflow template. Can retrieve previously instantiated template by specifying optional version parameter.", + "canonical": true, + "file": "workflow_template_service.get_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.GetWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "GetWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.GetWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async", + "title": "dataproc instantiateWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Instantiates a template and begins execution. The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished. The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted. The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see [Using WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].", + "canonical": true, + "file": "workflow_template_service.instantiate_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "InstantiateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": "TYPE_INT32" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "parameters", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "InstantiateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async", + "title": "dataproc instantiateInlineWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Instantiates a template and begins execution. This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished. The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted. The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see [Using WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].", + "canonical": true, + "file": "workflow_template_service.instantiate_inline_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "InstantiateInlineWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateInlineWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "template", + "type": ".google.cloud.dataproc.v1.WorkflowTemplate" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "InstantiateInlineWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateInlineWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_async", + "title": "dataproc updateWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Updates (replaces) workflow template. The updated template must contain version that matches the current server version.", + "canonical": true, + "file": "workflow_template_service.update_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.UpdateWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "template", + "type": ".google.cloud.dataproc.v1.WorkflowTemplate" + } + ], + "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "UpdateWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.UpdateWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async", + "title": "dataproc listWorkflowTemplates Sample", + "origin": "API_DEFINITION", + "description": " Lists workflows that match the specified filter in the request.", + "canonical": true, + "file": "workflow_template_service.list_workflow_templates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkflowTemplates", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.ListWorkflowTemplates", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dataproc.v1.ListWorkflowTemplatesResponse", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "ListWorkflowTemplates", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.ListWorkflowTemplates", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + }, + { + "regionTag": "dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async", + "title": "dataproc deleteWorkflowTemplate Sample", + "origin": "API_DEFINITION", + "description": " Deletes a workflow template. It does not cancel in-progress workflows.", + "canonical": true, + "file": "workflow_template_service.delete_workflow_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WorkflowTemplateServiceClient", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" + }, + "method": { + "shortName": "DeleteWorkflowTemplate", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate", + "service": { + "shortName": "WorkflowTemplateService", + "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js new file mode 100644 index 000000000000..d9c8feeafd13 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js @@ -0,0 +1,73 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, template) { + // [START dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates.create`, the resource name of the + * region has the following format: + * `projects/{project_id}/regions/{region}` + * * For `projects.locations.workflowTemplates.create`, the resource name of + * the location has the following format: + * `projects/{project_id}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. The Dataproc workflow template to create. + */ + // const template = {} + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callCreateWorkflowTemplate() { + // Construct request + const request = { + parent, + template, + }; + + // Run request + const response = await dataprocClient.createWorkflowTemplate(request); + console.log(response); + } + + callCreateWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js new file mode 100644 index 000000000000..bf139ac9534a --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates.delete`, the resource name + * of the template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * * For `projects.locations.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + */ + // const name = 'abc123' + /** + * Optional. The version of workflow template to delete. If specified, + * will only delete the template if the current server version matches + * specified version. + */ + // const version = 1234 + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callDeleteWorkflowTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.deleteWorkflowTemplate(request); + console.log(response); + } + + callDeleteWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js new file mode 100644 index 000000000000..e3cd6692cb77 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js @@ -0,0 +1,74 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates.get`, the resource name of the + * template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * * For `projects.locations.workflowTemplates.get`, the resource name of the + * template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + */ + // const name = 'abc123' + /** + * Optional. The version of workflow template to retrieve. Only previously + * instantiated versions can be retrieved. + * If unspecified, retrieves the current version. + */ + // const version = 1234 + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callGetWorkflowTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dataprocClient.getWorkflowTemplate(request); + console.log(response); + } + + callGetWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js new file mode 100644 index 000000000000..b63dc5afe9df --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, template) { + // [START dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates,instantiateinline`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * * For `projects.locations.workflowTemplates.instantiateinline`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. The workflow template to instantiate. + */ + // const template = {} + /** + * Optional. A tag that prevents multiple concurrent workflow + * instances with the same tag from running. This mitigates risk of + * concurrent instances started due to retries. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The tag must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callInstantiateInlineWorkflowTemplate() { + // Construct request + const request = { + parent, + template, + }; + + // Run request + const [operation] = await dataprocClient.instantiateInlineWorkflowTemplate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callInstantiateInlineWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js new file mode 100644 index 000000000000..6825252807ba --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js @@ -0,0 +1,92 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * * For `projects.locations.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + */ + // const name = 'abc123' + /** + * Optional. The version of workflow template to instantiate. If specified, + * the workflow will be instantiated only if the current version of + * the workflow template has the supplied version. + * This option cannot be used to instantiate a previous version of + * workflow template. + */ + // const version = 1234 + /** + * Optional. A tag that prevents multiple concurrent workflow + * instances with the same tag from running. This mitigates risk of + * concurrent instances started due to retries. + * It is recommended to always set this value to a + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). + * The tag must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + */ + // const requestId = 'abc123' + /** + * Optional. Map from parameter names to values that should be used for those + * parameters. Values may not exceed 1000 characters. + */ + // const parameters = [1,2,3,4] + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callInstantiateWorkflowTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dataprocClient.instantiateWorkflowTemplate(request); + const [response] = await operation.promise(); + console.log(response); + } + + callInstantiateWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js new file mode 100644 index 000000000000..664d3fb20f6b --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js @@ -0,0 +1,79 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * * For `projects.regions.workflowTemplates,list`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * * For `projects.locations.workflowTemplates.list`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of results to return in each response. + */ + // const pageSize = 1234 + /** + * Optional. The page token, returned by a previous call, to request the + * next page of results. + */ + // const pageToken = 'abc123' + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callListWorkflowTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dataprocClient.listWorkflowTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkflowTemplates(); + // [END dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_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-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js new file mode 100644 index 000000000000..afe4c4b9a550 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(template) { + // [START dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_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 updated workflow template. + * The `template.version` field must match the current version. + */ + // const template = {} + + // Imports the Dataproc library + const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; + + // Instantiates a client + const dataprocClient = new WorkflowTemplateServiceClient(); + + async function callUpdateWorkflowTemplate() { + // Construct request + const request = { + template, + }; + + // Run request + const response = await dataprocClient.updateWorkflowTemplate(request); + console.log(response); + } + + callUpdateWorkflowTemplate(); + // [END dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_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-dataproc/v1/src/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/index.ts new file mode 100644 index 000000000000..57d81e8f280a --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/index.ts @@ -0,0 +1,35 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const AutoscalingPolicyServiceClient = v1.AutoscalingPolicyServiceClient; +type AutoscalingPolicyServiceClient = v1.AutoscalingPolicyServiceClient; +const BatchControllerClient = v1.BatchControllerClient; +type BatchControllerClient = v1.BatchControllerClient; +const ClusterControllerClient = v1.ClusterControllerClient; +type ClusterControllerClient = v1.ClusterControllerClient; +const JobControllerClient = v1.JobControllerClient; +type JobControllerClient = v1.JobControllerClient; +const NodeGroupControllerClient = v1.NodeGroupControllerClient; +type NodeGroupControllerClient = v1.NodeGroupControllerClient; +const WorkflowTemplateServiceClient = v1.WorkflowTemplateServiceClient; +type WorkflowTemplateServiceClient = v1.WorkflowTemplateServiceClient; +export {v1, AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient}; +export default {v1, AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts new file mode 100644 index 000000000000..e5e3e37096a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts @@ -0,0 +1,1374 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos} 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/autoscaling_policy_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './autoscaling_policy_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The API interface for managing autoscaling policies in the + * Dataproc API. + * @class + * @memberof v1 + */ +export class AutoscalingPolicyServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + autoscalingPolicyServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AutoscalingPolicyServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 AutoscalingPolicyServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AutoscalingPolicyServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + }; + + // 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 = { + listAutoscalingPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'policies') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.AutoscalingPolicyService', 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.autoscalingPolicyServiceStub) { + return this.autoscalingPolicyServiceStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.AutoscalingPolicyService. + this.autoscalingPolicyServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.AutoscalingPolicyService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.AutoscalingPolicyService, + 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 autoscalingPolicyServiceStubMethods = + ['createAutoscalingPolicy', 'updateAutoscalingPolicy', 'getAutoscalingPolicy', 'listAutoscalingPolicies', 'deleteAutoscalingPolicy']; + for (const methodName of autoscalingPolicyServiceStubMethods) { + const callPromise = this.autoscalingPolicyServiceStub.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] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.autoscalingPolicyServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 -- + // ------------------- +/** + * Creates new autoscaling policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.create`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.autoscalingPolicies.create`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {google.cloud.dataproc.v1.AutoscalingPolicy} request.policy + * Required. The autoscaling policy to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js + * region_tag:dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async + */ + createAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|undefined, {}|undefined + ]>; + createAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + createAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + createAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|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.createAutoscalingPolicy(request, options, callback); + } +/** + * Updates (replaces) autoscaling policy. + * + * Disabled check for update_mask, because all updates will be full + * replacements. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dataproc.v1.AutoscalingPolicy} request.policy + * Required. The updated autoscaling policy. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js + * region_tag:dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_async + */ + updateAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|undefined, {}|undefined + ]>; + updateAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + updateAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + updateAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|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({ + 'policy.name': request.policy!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAutoscalingPolicy(request, options, callback); + } +/** + * Retrieves autoscaling policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The "resource name" of the autoscaling policy, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.get`, the resource name + * of the policy has the following format: + * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + * + * * For `projects.locations.autoscalingPolicies.get`, the resource name + * of the policy has the following format: + * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js + * region_tag:dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async + */ + getAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|undefined, {}|undefined + ]>; + getAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + getAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + getAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy, + protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|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.getAutoscalingPolicy(request, options, callback); + } +/** + * Deletes an autoscaling policy. It is an error to delete an autoscaling + * policy that is in use by one or more clusters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The "resource name" of the autoscaling policy, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.delete`, the resource name + * of the policy has the following format: + * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` + * + * * For `projects.locations.autoscalingPolicies.delete`, the resource name + * of the policy has the following format: + * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js + * region_tag:dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async + */ + deleteAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|undefined, {}|undefined + ]>; + deleteAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + deleteAutoscalingPolicy( + request: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): void; + deleteAutoscalingPolicy( + request?: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|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.deleteAutoscalingPolicy(request, options, callback); + } + + /** + * Lists autoscaling policies in the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.list`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.autoscalingPolicies.list`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * Must be less than or equal to 1000. Defaults to 100. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. + * 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 `listAutoscalingPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAutoscalingPolicies( + request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy[], + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest|null, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse + ]>; + listAutoscalingPolicies( + request: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): void; + listAutoscalingPolicies( + request: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): void; + listAutoscalingPolicies( + request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IAutoscalingPolicy>, + callback?: PaginationCallback< + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): + Promise<[ + protos.google.cloud.dataproc.v1.IAutoscalingPolicy[], + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest|null, + protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.listAutoscalingPolicies(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 "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.list`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.autoscalingPolicies.list`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * Must be less than or equal to 1000. Defaults to 100. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy} 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 `listAutoscalingPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listAutoscalingPoliciesStream( + request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + 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['listAutoscalingPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAutoscalingPolicies.createStream( + this.innerApiCalls.listAutoscalingPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAutoscalingPolicies`, 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 "resource name" of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.autoscalingPolicies.list`, the resource name + * of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.autoscalingPolicies.list`, the resource name + * of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * Must be less than or equal to 1000. Defaults to 100. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js + * region_tag:dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async + */ + listAutoscalingPoliciesAsync( + request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, + 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['listAutoscalingPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAutoscalingPolicies.asyncIterate( + this.innerApiCalls['listAutoscalingPolicies'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * 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 nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * 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 projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * 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.autoscalingPolicyServiceStub && !this._terminated) { + return this.autoscalingPolicyServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json new file mode 100644 index 000000000000..09bd892268fc --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.AutoscalingPolicyService": { + "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": { + "CreateAutoscalingPolicy": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAutoscalingPolicy": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetAutoscalingPolicy": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAutoscalingPolicies": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteAutoscalingPolicy": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts new file mode 100644 index 000000000000..c7a2486815f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts @@ -0,0 +1,1560 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/batch_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './batch_controller_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The BatchController provides methods to manage batch workloads. + * @class + * @memberof v1 + */ +export class BatchControllerClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + batchControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BatchControllerClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 BatchControllerClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof BatchControllerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + }; + + // 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 = { + listBatches: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'batches') + }; + + 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) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createBatchResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Batch') as gax.protobuf.Type; + const createBatchMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.BatchOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBatch: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBatchResponse.decode.bind(createBatchResponse), + createBatchMetadata.decode.bind(createBatchMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.BatchController', 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.batchControllerStub) { + return this.batchControllerStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.BatchController. + this.batchControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.BatchController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.BatchController, + 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 batchControllerStubMethods = + ['createBatch', 'getBatch', 'listBatches', 'deleteBatch']; + for (const methodName of batchControllerStubMethods) { + const callPromise = this.batchControllerStub.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.batchControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 batch workload resource representation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fully qualified name of the batch to retrieve + * in the format + * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Batch|Batch}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/batch_controller.get_batch.js + * region_tag:dataproc_v1_generated_BatchController_GetBatch_async + */ + getBatch( + request?: protos.google.cloud.dataproc.v1.IGetBatchRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|undefined, {}|undefined + ]>; + getBatch( + request: protos.google.cloud.dataproc.v1.IGetBatchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, + {}|null|undefined>): void; + getBatch( + request: protos.google.cloud.dataproc.v1.IGetBatchRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, + {}|null|undefined>): void; + getBatch( + request?: protos.google.cloud.dataproc.v1.IGetBatchRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IBatch, + protos.google.cloud.dataproc.v1.IGetBatchRequest|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.getBatch(request, options, callback); + } +/** + * Deletes the batch workload resource. If the batch is not in terminal state, + * the delete fails and the response returns `FAILED_PRECONDITION`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fully qualified name of the batch to retrieve + * in the format + * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/batch_controller.delete_batch.js + * region_tag:dataproc_v1_generated_BatchController_DeleteBatch_async + */ + deleteBatch( + request?: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|undefined, {}|undefined + ]>; + deleteBatch( + request: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, + {}|null|undefined>): void; + deleteBatch( + request: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, + {}|null|undefined>): void; + deleteBatch( + request?: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteBatchRequest|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.deleteBatch(request, options, callback); + } + +/** + * Creates a batch workload that executes asynchronously. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this batch will be created. + * @param {google.cloud.dataproc.v1.Batch} request.batch + * Required. The batch to create. + * @param {string} [request.batchId] + * Optional. The ID to use for the batch, which will become the final + * component of the batch's resource name. + * + * This value must be 4-63 characters. Valid characters are `/{@link protos.0-9|a-z}-/`. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the service + * receives two + * [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s + * with the same request_id, the second request is ignored and the + * Operation that corresponds to the first Batch created and stored + * in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The value must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/batch_controller.create_batch.js + * region_tag:dataproc_v1_generated_BatchController_CreateBatch_async + */ + createBatch( + request?: protos.google.cloud.dataproc.v1.ICreateBatchRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBatch( + request: protos.google.cloud.dataproc.v1.ICreateBatchRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBatch( + request: protos.google.cloud.dataproc.v1.ICreateBatchRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBatch( + request?: protos.google.cloud.dataproc.v1.ICreateBatchRequest, + 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.createBatch(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBatch()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/batch_controller.create_batch.js + * region_tag:dataproc_v1_generated_BatchController_CreateBatch_async + */ + async checkCreateBatchProgress(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.createBatch, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists batch workloads. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of batches. + * @param {number} [request.pageSize] + * Optional. The maximum number of batches to return in each response. + * The service may return fewer than this value. + * The default page size is 20; the maximum page size is 1000. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous `ListBatches` call. + * Provide this token to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter for the batches to return in the response. + * + * A filter is a logical expression constraining the values of various fields + * in each batch resource. Filters are case sensitive, and may contain + * multiple clauses combined with logical operators (AND/OR). + * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. + * + * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` + * filters for batches in state RUNNING that were created before 2023-01-01 + * + * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + * description of the filter syntax and a list of supported comparisons. + * @param {string} [request.orderBy] + * Optional. Field(s) on which to sort the list of batches. + * + * Currently the only supported sort orders are unspecified (empty) and + * `create_time desc` to sort by most recently created batches first. + * + * See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Batch|Batch}. + * 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 `listBatchesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBatches( + request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IBatch[], + protos.google.cloud.dataproc.v1.IListBatchesRequest|null, + protos.google.cloud.dataproc.v1.IListBatchesResponse + ]>; + listBatches( + request: protos.google.cloud.dataproc.v1.IListBatchesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListBatchesRequest, + protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IBatch>): void; + listBatches( + request: protos.google.cloud.dataproc.v1.IListBatchesRequest, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListBatchesRequest, + protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IBatch>): void; + listBatches( + request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dataproc.v1.IListBatchesRequest, + protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IBatch>, + callback?: PaginationCallback< + protos.google.cloud.dataproc.v1.IListBatchesRequest, + protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IBatch>): + Promise<[ + protos.google.cloud.dataproc.v1.IBatch[], + protos.google.cloud.dataproc.v1.IListBatchesRequest|null, + protos.google.cloud.dataproc.v1.IListBatchesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.listBatches(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of batches. + * @param {number} [request.pageSize] + * Optional. The maximum number of batches to return in each response. + * The service may return fewer than this value. + * The default page size is 20; the maximum page size is 1000. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous `ListBatches` call. + * Provide this token to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter for the batches to return in the response. + * + * A filter is a logical expression constraining the values of various fields + * in each batch resource. Filters are case sensitive, and may contain + * multiple clauses combined with logical operators (AND/OR). + * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. + * + * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` + * filters for batches in state RUNNING that were created before 2023-01-01 + * + * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + * description of the filter syntax and a list of supported comparisons. + * @param {string} [request.orderBy] + * Optional. Field(s) on which to sort the list of batches. + * + * Currently the only supported sort orders are unspecified (empty) and + * `create_time desc` to sort by most recently created batches first. + * + * See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Batch|Batch} 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 `listBatchesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBatchesStream( + request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, + 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['listBatches']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBatches.createStream( + this.innerApiCalls.listBatches as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBatches`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of batches. + * @param {number} [request.pageSize] + * Optional. The maximum number of batches to return in each response. + * The service may return fewer than this value. + * The default page size is 20; the maximum page size is 1000. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous `ListBatches` call. + * Provide this token to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter for the batches to return in the response. + * + * A filter is a logical expression constraining the values of various fields + * in each batch resource. Filters are case sensitive, and may contain + * multiple clauses combined with logical operators (AND/OR). + * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. + * + * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` + * filters for batches in state RUNNING that were created before 2023-01-01 + * + * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed + * description of the filter syntax and a list of supported comparisons. + * @param {string} [request.orderBy] + * Optional. Field(s) on which to sort the list of batches. + * + * Currently the only supported sort orders are unspecified (empty) and + * `create_time desc` to sort by most recently created batches first. + * + * See https://google.aip.dev/132#ordering for more details. + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.dataproc.v1.Batch|Batch}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/batch_controller.list_batches.js + * region_tag:dataproc_v1_generated_BatchController_ListBatches_async + */ + listBatchesAsync( + request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, + 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['listBatches']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBatches.asyncIterate( + this.innerApiCalls['listBatches'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * 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 nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * 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 projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * 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.batchControllerStub && !this._terminated) { + return this.batchControllerStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json new file mode 100644 index 000000000000..a451087cbb21 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.BatchController": { + "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": { + "CreateBatch": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBatch": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBatches": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBatch": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts new file mode 100644 index 000000000000..38ac8b1bf28d --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts @@ -0,0 +1,2157 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/cluster_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cluster_controller_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The ClusterControllerService provides methods to manage clusters + * of Compute Engine instances. + * @class + * @memberof v1 + */ +export class ClusterControllerClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + clusterControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ClusterControllerClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 ClusterControllerClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ClusterControllerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listClusters: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters') + }; + + 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) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createClusterResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; + const createClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + const updateClusterResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; + const updateClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + const stopClusterResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; + const stopClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + const startClusterResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; + const startClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + const deleteClusterResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + const diagnoseClusterResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.DiagnoseClusterResults') as gax.protobuf.Type; + const diagnoseClusterMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createClusterResponse.decode.bind(createClusterResponse), + createClusterMetadata.decode.bind(createClusterMetadata)), + updateCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateClusterResponse.decode.bind(updateClusterResponse), + updateClusterMetadata.decode.bind(updateClusterMetadata)), + stopCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopClusterResponse.decode.bind(stopClusterResponse), + stopClusterMetadata.decode.bind(stopClusterMetadata)), + startCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startClusterResponse.decode.bind(startClusterResponse), + startClusterMetadata.decode.bind(startClusterMetadata)), + deleteCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteClusterResponse.decode.bind(deleteClusterResponse), + deleteClusterMetadata.decode.bind(deleteClusterMetadata)), + diagnoseCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + diagnoseClusterResponse.decode.bind(diagnoseClusterResponse), + diagnoseClusterMetadata.decode.bind(diagnoseClusterMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.ClusterController', 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.clusterControllerStub) { + return this.clusterControllerStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.ClusterController. + this.clusterControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.ClusterController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.ClusterController, + 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 clusterControllerStubMethods = + ['createCluster', 'updateCluster', 'stopCluster', 'startCluster', 'deleteCluster', 'getCluster', 'listClusters', 'diagnoseCluster']; + for (const methodName of clusterControllerStubMethods) { + const callPromise = this.clusterControllerStub.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.clusterControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 resource representation for a cluster in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster 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 {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.get_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_GetCluster_async + */ + getCluster( + request?: protos.google.cloud.dataproc.v1.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|undefined, {}|undefined + ]>; + getCluster( + request: protos.google.cloud.dataproc.v1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request: protos.google.cloud.dataproc.v1.IGetClusterRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request?: protos.google.cloud.dataproc.v1.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.ICluster, + protos.google.cloud.dataproc.v1.IGetClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCluster(request, options, callback); + } + +/** + * Creates a cluster in a project. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {google.cloud.dataproc.v1.Cluster} request.cluster + * Required. The cluster to create. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {google.cloud.dataproc.v1.FailureAction} [request.actionOnFailedPrimaryWorkers] + * Optional. Failure action when primary worker creation fails. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.create_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_CreateCluster_async + */ + createCluster( + request?: protos.google.cloud.dataproc.v1.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCluster( + request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request?: protos.google.cloud.dataproc.v1.ICreateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.create_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_CreateCluster_async + */ + async checkCreateClusterProgress(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.createCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a cluster in a project. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + * The cluster must be in a + * {@link protos.google.cloud.dataproc.v1.ClusterStatus.State|`RUNNING`} state or an error + * is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project the + * cluster belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster name. + * @param {google.cloud.dataproc.v1.Cluster} request.cluster + * Required. The changes to the cluster. + * @param {google.protobuf.Duration} [request.gracefulDecommissionTimeout] + * Optional. Timeout for graceful YARN decommissioning. Graceful + * decommissioning allows removing nodes from the cluster without + * interrupting jobs in progress. Timeout specifies how long to wait for jobs + * in progress to finish before forcefully removing nodes (and potentially + * interrupting jobs). Default timeout is 0 (for forceful decommission), and + * the maximum allowed timeout is 1 day. (see JSON representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * + * Only supported on Dataproc image versions 1.2 and higher. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Specifies the path, relative to `Cluster`, of + * the field to update. For example, to change the number of workers + * in a cluster to 5, the `update_mask` parameter would be + * specified as `config.worker_config.num_instances`, + * and the `PATCH` request body would specify the new value, as follows: + * + * { + * "config":{ + * "workerConfig":{ + * "numInstances":"5" + * } + * } + * } + * Similarly, to change the number of preemptible workers in a cluster to 5, + * the `update_mask` parameter would be + * `config.secondary_worker_config.num_instances`, and the `PATCH` request + * body would be set as follows: + * + * { + * "config":{ + * "secondaryWorkerConfig":{ + * "numInstances":"5" + * } + * } + * } + * Note: Currently, only the following fields can be updated: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or + * change autoscaling policies
+ * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server + * receives two + * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.update_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_UpdateCluster_async + */ + updateCluster( + request?: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCluster( + request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request?: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.update_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_UpdateCluster_async + */ + async checkUpdateClusterProgress(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.updateCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops a cluster in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project the + * cluster belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster name. + * @param {string} [request.clusterUuid] + * Optional. Specifying the `cluster_uuid` means the RPC will fail + * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server + * receives two + * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.stop_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_StopCluster_async + */ + stopCluster( + request?: protos.google.cloud.dataproc.v1.IStopClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopCluster( + request: protos.google.cloud.dataproc.v1.IStopClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopCluster( + request: protos.google.cloud.dataproc.v1.IStopClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopCluster( + request?: protos.google.cloud.dataproc.v1.IStopClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.stop_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_StopCluster_async + */ + async checkStopClusterProgress(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.stopCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts a cluster in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project the + * cluster belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster name. + * @param {string} [request.clusterUuid] + * Optional. Specifying the `cluster_uuid` means the RPC will fail + * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server + * receives two + * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.start_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_StartCluster_async + */ + startCluster( + request?: protos.google.cloud.dataproc.v1.IStartClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startCluster( + request: protos.google.cloud.dataproc.v1.IStartClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startCluster( + request: protos.google.cloud.dataproc.v1.IStartClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startCluster( + request?: protos.google.cloud.dataproc.v1.IStartClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.startCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.start_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_StartCluster_async + */ + async checkStartClusterProgress(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.startCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a cluster in a project. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster name. + * @param {string} [request.clusterUuid] + * Optional. Specifying the `cluster_uuid` means the RPC should fail + * (with error NOT_FOUND) if cluster with specified UUID does not exist. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server + * receives two + * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.delete_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_DeleteCluster_async + */ + deleteCluster( + request?: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteCluster( + request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request?: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.delete_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_DeleteCluster_async + */ + async checkDeleteClusterProgress(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.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets cluster diagnostic information. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). + * After the operation completes, + * {@link protos.google.longrunning.Operation.response|Operation.response} + * contains + * [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.clusterName + * Required. The cluster name. + * @param {string} [request.tarballGcsDir] + * Optional. The output Cloud Storage directory for the diagnostic + * tarball. If not specified, a task-specific directory in the cluster's + * staging bucket will be used. + * @param {google.type.Interval} [request.diagnosisInterval] + * Optional. Time interval in which diagnosis should be carried out on the + * cluster. + * @param {string[]} [request.jobs] + * Optional. Specifies a list of jobs on which diagnosis is to be performed. + * Format: projects/{project}/regions/{region}/jobs/{job} + * @param {string[]} [request.yarnApplicationIds] + * Optional. Specifies a list of yarn applications on which diagnosis is to be + * performed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.diagnose_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_DiagnoseCluster_async + */ + diagnoseCluster( + request?: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + diagnoseCluster( + request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + diagnoseCluster( + request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + diagnoseCluster( + request?: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'cluster_name': request.clusterName ?? '', + }); + this.initialize(); + return this.innerApiCalls.diagnoseCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `diagnoseCluster()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.diagnose_cluster.js + * region_tag:dataproc_v1_generated_ClusterController_DiagnoseCluster_async + */ + async checkDiagnoseClusterProgress(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.diagnoseCluster, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all regions/{region}/clusters in a project alphabetically. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} [request.filter] + * Optional. A filter constraining the clusters to list. Filters are + * case-sensitive and have the following syntax: + * + * field = value [AND [field = value]] ... + * + * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, + * and `[KEY]` is a label key. **value** can be `*` to match all values. + * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, + * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` + * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` + * contains the `DELETING` and `ERROR` states. + * `clusterName` is the name of the cluster provided at creation time. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND clusterName = mycluster + * AND labels.env = staging AND labels.starred = * + * @param {number} [request.pageSize] + * Optional. The standard List page size. + * @param {string} [request.pageToken] + * Optional. 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 {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. + * 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 `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listClusters( + request?: protos.google.cloud.dataproc.v1.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.ICluster[], + protos.google.cloud.dataproc.v1.IListClustersRequest|null, + protos.google.cloud.dataproc.v1.IListClustersResponse + ]>; + listClusters( + request: protos.google.cloud.dataproc.v1.IListClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListClustersRequest, + protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, + protos.google.cloud.dataproc.v1.ICluster>): void; + listClusters( + request: protos.google.cloud.dataproc.v1.IListClustersRequest, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListClustersRequest, + protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, + protos.google.cloud.dataproc.v1.ICluster>): void; + listClusters( + request?: protos.google.cloud.dataproc.v1.IListClustersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dataproc.v1.IListClustersRequest, + protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, + protos.google.cloud.dataproc.v1.ICluster>, + callback?: PaginationCallback< + protos.google.cloud.dataproc.v1.IListClustersRequest, + protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, + protos.google.cloud.dataproc.v1.ICluster>): + Promise<[ + protos.google.cloud.dataproc.v1.ICluster[], + protos.google.cloud.dataproc.v1.IListClustersRequest|null, + protos.google.cloud.dataproc.v1.IListClustersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + this.initialize(); + return this.innerApiCalls.listClusters(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.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} [request.filter] + * Optional. A filter constraining the clusters to list. Filters are + * case-sensitive and have the following syntax: + * + * field = value [AND [field = value]] ... + * + * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, + * and `[KEY]` is a label key. **value** can be `*` to match all values. + * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, + * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` + * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` + * contains the `DELETING` and `ERROR` states. + * `clusterName` is the name of the cluster provided at creation time. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND clusterName = mycluster + * AND labels.env = staging AND labels.starred = * + * @param {number} [request.pageSize] + * Optional. The standard List page size. + * @param {string} [request.pageToken] + * Optional. 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 {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Cluster|Cluster} 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 `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listClustersStream( + request?: protos.google.cloud.dataproc.v1.IListClustersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + const defaultCallSettings = this._defaults['listClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listClusters.createStream( + this.innerApiCalls.listClusters as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listClusters`, 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.projectId + * Required. The ID of the Google Cloud Platform project that the cluster + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} [request.filter] + * Optional. A filter constraining the clusters to list. Filters are + * case-sensitive and have the following syntax: + * + * field = value [AND [field = value]] ... + * + * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, + * and `[KEY]` is a label key. **value** can be `*` to match all values. + * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, + * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` + * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` + * contains the `DELETING` and `ERROR` states. + * `clusterName` is the name of the cluster provided at creation time. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND clusterName = mycluster + * AND labels.env = staging AND labels.starred = * + * @param {number} [request.pageSize] + * Optional. The standard List page size. + * @param {string} [request.pageToken] + * Optional. 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cluster_controller.list_clusters.js + * region_tag:dataproc_v1_generated_ClusterController_ListClusters_async + */ + listClustersAsync( + request?: protos.google.cloud.dataproc.v1.IListClustersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + const defaultCallSettings = this._defaults['listClusters']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listClusters.asyncIterate( + this.innerApiCalls['listClusters'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * Return a fully-qualified nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * Return a fully-qualified projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.clusterControllerStub && !this._terminated) { + return this.clusterControllerStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json new file mode 100644 index 000000000000..6f5f5f3dd1d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json @@ -0,0 +1,72 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.ClusterController": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "CreateCluster": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateCluster": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StopCluster": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartCluster": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCluster": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetCluster": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListClusters": { + "timeout_millis": 300000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DiagnoseCluster": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json new file mode 100644 index 000000000000..36b4ef4bf5d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json @@ -0,0 +1,453 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.dataproc.v1", + "libraryPackage": "@google-cloud/dataproc", + "services": { + "AutoscalingPolicyService": { + "clients": { + "grpc": { + "libraryClient": "AutoscalingPolicyServiceClient", + "rpcs": { + "CreateAutoscalingPolicy": { + "methods": [ + "createAutoscalingPolicy" + ] + }, + "UpdateAutoscalingPolicy": { + "methods": [ + "updateAutoscalingPolicy" + ] + }, + "GetAutoscalingPolicy": { + "methods": [ + "getAutoscalingPolicy" + ] + }, + "DeleteAutoscalingPolicy": { + "methods": [ + "deleteAutoscalingPolicy" + ] + }, + "ListAutoscalingPolicies": { + "methods": [ + "listAutoscalingPolicies", + "listAutoscalingPoliciesStream", + "listAutoscalingPoliciesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AutoscalingPolicyServiceClient", + "rpcs": { + "CreateAutoscalingPolicy": { + "methods": [ + "createAutoscalingPolicy" + ] + }, + "UpdateAutoscalingPolicy": { + "methods": [ + "updateAutoscalingPolicy" + ] + }, + "GetAutoscalingPolicy": { + "methods": [ + "getAutoscalingPolicy" + ] + }, + "DeleteAutoscalingPolicy": { + "methods": [ + "deleteAutoscalingPolicy" + ] + }, + "ListAutoscalingPolicies": { + "methods": [ + "listAutoscalingPolicies", + "listAutoscalingPoliciesStream", + "listAutoscalingPoliciesAsync" + ] + } + } + } + } + }, + "BatchController": { + "clients": { + "grpc": { + "libraryClient": "BatchControllerClient", + "rpcs": { + "GetBatch": { + "methods": [ + "getBatch" + ] + }, + "DeleteBatch": { + "methods": [ + "deleteBatch" + ] + }, + "CreateBatch": { + "methods": [ + "createBatch" + ] + }, + "ListBatches": { + "methods": [ + "listBatches", + "listBatchesStream", + "listBatchesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BatchControllerClient", + "rpcs": { + "GetBatch": { + "methods": [ + "getBatch" + ] + }, + "DeleteBatch": { + "methods": [ + "deleteBatch" + ] + }, + "CreateBatch": { + "methods": [ + "createBatch" + ] + }, + "ListBatches": { + "methods": [ + "listBatches", + "listBatchesStream", + "listBatchesAsync" + ] + } + } + } + } + }, + "ClusterController": { + "clients": { + "grpc": { + "libraryClient": "ClusterControllerClient", + "rpcs": { + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "StopCluster": { + "methods": [ + "stopCluster" + ] + }, + "StartCluster": { + "methods": [ + "startCluster" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "DiagnoseCluster": { + "methods": [ + "diagnoseCluster" + ] + }, + "ListClusters": { + "methods": [ + "listClusters", + "listClustersStream", + "listClustersAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ClusterControllerClient", + "rpcs": { + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "StopCluster": { + "methods": [ + "stopCluster" + ] + }, + "StartCluster": { + "methods": [ + "startCluster" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "DiagnoseCluster": { + "methods": [ + "diagnoseCluster" + ] + }, + "ListClusters": { + "methods": [ + "listClusters", + "listClustersStream", + "listClustersAsync" + ] + } + } + } + } + }, + "JobController": { + "clients": { + "grpc": { + "libraryClient": "JobControllerClient", + "rpcs": { + "SubmitJob": { + "methods": [ + "submitJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "CancelJob": { + "methods": [ + "cancelJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "SubmitJobAsOperation": { + "methods": [ + "submitJobAsOperation" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "JobControllerClient", + "rpcs": { + "SubmitJob": { + "methods": [ + "submitJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "CancelJob": { + "methods": [ + "cancelJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "SubmitJobAsOperation": { + "methods": [ + "submitJobAsOperation" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + } + } + }, + "NodeGroupController": { + "clients": { + "grpc": { + "libraryClient": "NodeGroupControllerClient", + "rpcs": { + "GetNodeGroup": { + "methods": [ + "getNodeGroup" + ] + }, + "CreateNodeGroup": { + "methods": [ + "createNodeGroup" + ] + }, + "ResizeNodeGroup": { + "methods": [ + "resizeNodeGroup" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "NodeGroupControllerClient", + "rpcs": { + "GetNodeGroup": { + "methods": [ + "getNodeGroup" + ] + }, + "CreateNodeGroup": { + "methods": [ + "createNodeGroup" + ] + }, + "ResizeNodeGroup": { + "methods": [ + "resizeNodeGroup" + ] + } + } + } + } + }, + "WorkflowTemplateService": { + "clients": { + "grpc": { + "libraryClient": "WorkflowTemplateServiceClient", + "rpcs": { + "CreateWorkflowTemplate": { + "methods": [ + "createWorkflowTemplate" + ] + }, + "GetWorkflowTemplate": { + "methods": [ + "getWorkflowTemplate" + ] + }, + "UpdateWorkflowTemplate": { + "methods": [ + "updateWorkflowTemplate" + ] + }, + "DeleteWorkflowTemplate": { + "methods": [ + "deleteWorkflowTemplate" + ] + }, + "InstantiateWorkflowTemplate": { + "methods": [ + "instantiateWorkflowTemplate" + ] + }, + "InstantiateInlineWorkflowTemplate": { + "methods": [ + "instantiateInlineWorkflowTemplate" + ] + }, + "ListWorkflowTemplates": { + "methods": [ + "listWorkflowTemplates", + "listWorkflowTemplatesStream", + "listWorkflowTemplatesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkflowTemplateServiceClient", + "rpcs": { + "CreateWorkflowTemplate": { + "methods": [ + "createWorkflowTemplate" + ] + }, + "GetWorkflowTemplate": { + "methods": [ + "getWorkflowTemplate" + ] + }, + "UpdateWorkflowTemplate": { + "methods": [ + "updateWorkflowTemplate" + ] + }, + "DeleteWorkflowTemplate": { + "methods": [ + "deleteWorkflowTemplate" + ] + }, + "InstantiateWorkflowTemplate": { + "methods": [ + "instantiateWorkflowTemplate" + ] + }, + "InstantiateInlineWorkflowTemplate": { + "methods": [ + "instantiateInlineWorkflowTemplate" + ] + }, + "ListWorkflowTemplates": { + "methods": [ + "listWorkflowTemplates", + "listWorkflowTemplatesStream", + "listWorkflowTemplatesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts new file mode 100644 index 000000000000..2d24fc7037e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts @@ -0,0 +1,24 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {AutoscalingPolicyServiceClient} from './autoscaling_policy_service_client'; +export {BatchControllerClient} from './batch_controller_client'; +export {ClusterControllerClient} from './cluster_controller_client'; +export {JobControllerClient} from './job_controller_client'; +export {NodeGroupControllerClient} from './node_group_controller_client'; +export {WorkflowTemplateServiceClient} from './workflow_template_service_client'; diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts new file mode 100644 index 000000000000..fd72ca4526d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts @@ -0,0 +1,1775 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/job_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './job_controller_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The JobController provides methods to manage jobs. + * @class + * @memberof v1 + */ +export class JobControllerClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + jobControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of JobControllerClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 JobControllerClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof JobControllerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + }; + + // 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 = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + 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) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const submitJobAsOperationResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.Job') as gax.protobuf.Type; + const submitJobAsOperationMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.JobMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + submitJobAsOperation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + submitJobAsOperationResponse.decode.bind(submitJobAsOperationResponse), + submitJobAsOperationMetadata.decode.bind(submitJobAsOperationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.JobController', 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.jobControllerStub) { + return this.jobControllerStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.JobController. + this.jobControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.JobController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.JobController, + 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 jobControllerStubMethods = + ['submitJob', 'submitJobAsOperation', 'getJob', 'listJobs', 'updateJob', 'cancelJob', 'deleteJob']; + for (const methodName of jobControllerStubMethods) { + const callPromise = this.jobControllerStub.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.jobControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 -- + // ------------------- +/** + * Submits a job to a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {google.cloud.dataproc.v1.Job} request.job + * Required. The job resource. + * @param {string} [request.requestId] + * Optional. A unique id used to identify the request. If the server + * receives two + * [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.cloud.dataproc.v1.Job|Job} created and stored in the backend + * is returned. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The id must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.submit_job.js + * region_tag:dataproc_v1_generated_JobController_SubmitJob_async + */ + submitJob( + request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|undefined, {}|undefined + ]>; + submitJob( + request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, + {}|null|undefined>): void; + submitJob( + request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, + {}|null|undefined>): void; + submitJob( + request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ISubmitJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + this.initialize(); + return this.innerApiCalls.submitJob(request, options, callback); + } +/** + * Gets the resource representation for a job in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.jobId + * Required. The job ID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.get_job.js + * region_tag:dataproc_v1_generated_JobController_GetJob_async + */ + getJob( + request?: protos.google.cloud.dataproc.v1.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.dataproc.v1.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.dataproc.v1.IGetJobRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request?: protos.google.cloud.dataproc.v1.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } +/** + * Updates a job in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.jobId + * Required. The job ID. + * @param {google.cloud.dataproc.v1.Job} request.job + * Required. The changes to the job. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Specifies the path, relative to Job, of + * the field to update. For example, to update the labels of a Job the + * update_mask parameter would be specified as + * labels, and the `PATCH` request body would specify the new + * value. Note: Currently, labels is the only + * field that can be 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 {@link protos.google.cloud.dataproc.v1.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.update_job.js + * region_tag:dataproc_v1_generated_JobController_UpdateJob_async + */ + updateJob( + request?: protos.google.cloud.dataproc.v1.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.cloud.dataproc.v1.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.cloud.dataproc.v1.IUpdateJobRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request?: protos.google.cloud.dataproc.v1.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } +/** + * Starts a job cancellation request. To access the job resource + * after cancellation, call + * [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) + * or + * [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.jobId + * Required. The job ID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.cancel_job.js + * region_tag:dataproc_v1_generated_JobController_CancelJob_async + */ + cancelJob( + request?: protos.google.cloud.dataproc.v1.ICancelJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|undefined, {}|undefined + ]>; + cancelJob( + request: protos.google.cloud.dataproc.v1.ICancelJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, + {}|null|undefined>): void; + cancelJob( + request: protos.google.cloud.dataproc.v1.ICancelJobRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, + {}|null|undefined>): void; + cancelJob( + request?: protos.google.cloud.dataproc.v1.ICancelJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IJob, + protos.google.cloud.dataproc.v1.ICancelJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelJob(request, options, callback); + } +/** + * Deletes the job from the project. If the job is active, the delete fails, + * and the response returns `FAILED_PRECONDITION`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {string} request.jobId + * Required. The job ID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.delete_job.js + * region_tag:dataproc_v1_generated_JobController_DeleteJob_async + */ + deleteJob( + request?: protos.google.cloud.dataproc.v1.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.dataproc.v1.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.dataproc.v1.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request?: protos.google.cloud.dataproc.v1.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + 'job_id': request.jobId ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } + +/** + * Submits job to a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {google.cloud.dataproc.v1.Job} request.job + * Required. The job resource. + * @param {string} [request.requestId] + * Optional. A unique id used to identify the request. If the server + * receives two + * [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s + * with the same id, then the second request will be ignored and the + * first {@link protos.google.cloud.dataproc.v1.Job|Job} created and stored in the backend + * is returned. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The id must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.submit_job_as_operation.js + * region_tag:dataproc_v1_generated_JobController_SubmitJobAsOperation_async + */ + submitJobAsOperation( + request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + submitJobAsOperation( + request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + submitJobAsOperation( + request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + submitJobAsOperation( + request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + this.initialize(); + return this.innerApiCalls.submitJobAsOperation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `submitJobAsOperation()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.submit_job_as_operation.js + * region_tag:dataproc_v1_generated_JobController_SubmitJobAsOperation_async + */ + async checkSubmitJobAsOperationProgress(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.submitJobAsOperation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists regions/{region}/jobs in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {number} [request.pageSize] + * Optional. The number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {string} [request.clusterName] + * Optional. If set, the returned jobs list includes only jobs that were + * submitted to the named cluster. + * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] + * Optional. Specifies enumerated categories of jobs to list. + * (default = match ALL jobs). + * + * If `filter` is provided, `jobStateMatcher` will be ignored. + * @param {string} [request.filter] + * Optional. A filter constraining the jobs to list. Filters are + * case-sensitive and have the following syntax: + * + * [field = value] AND [field [= value]] ... + * + * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label + * key. **value** can be `*` to match all values. + * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND labels.env = staging AND labels.starred = * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Job|Job}. + * 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 `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobs( + request?: protos.google.cloud.dataproc.v1.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IJob[], + protos.google.cloud.dataproc.v1.IListJobsRequest|null, + protos.google.cloud.dataproc.v1.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.dataproc.v1.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListJobsRequest, + protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, + protos.google.cloud.dataproc.v1.IJob>): void; + listJobs( + request: protos.google.cloud.dataproc.v1.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListJobsRequest, + protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, + protos.google.cloud.dataproc.v1.IJob>): void; + listJobs( + request?: protos.google.cloud.dataproc.v1.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dataproc.v1.IListJobsRequest, + protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, + protos.google.cloud.dataproc.v1.IJob>, + callback?: PaginationCallback< + protos.google.cloud.dataproc.v1.IListJobsRequest, + protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, + protos.google.cloud.dataproc.v1.IJob>): + Promise<[ + protos.google.cloud.dataproc.v1.IJob[], + protos.google.cloud.dataproc.v1.IListJobsRequest|null, + protos.google.cloud.dataproc.v1.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(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.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {number} [request.pageSize] + * Optional. The number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {string} [request.clusterName] + * Optional. If set, the returned jobs list includes only jobs that were + * submitted to the named cluster. + * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] + * Optional. Specifies enumerated categories of jobs to list. + * (default = match ALL jobs). + * + * If `filter` is provided, `jobStateMatcher` will be ignored. + * @param {string} [request.filter] + * Optional. A filter constraining the jobs to list. Filters are + * case-sensitive and have the following syntax: + * + * [field = value] AND [field [= value]] ... + * + * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label + * key. **value** can be `*` to match all values. + * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND labels.env = staging AND labels.starred = * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Job|Job} 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 `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listJobsStream( + request?: protos.google.cloud.dataproc.v1.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, 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.projectId + * Required. The ID of the Google Cloud Platform project that the job + * belongs to. + * @param {string} request.region + * Required. The Dataproc region in which to handle the request. + * @param {number} [request.pageSize] + * Optional. The number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {string} [request.clusterName] + * Optional. If set, the returned jobs list includes only jobs that were + * submitted to the named cluster. + * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] + * Optional. Specifies enumerated categories of jobs to list. + * (default = match ALL jobs). + * + * If `filter` is provided, `jobStateMatcher` will be ignored. + * @param {string} [request.filter] + * Optional. A filter constraining the jobs to list. Filters are + * case-sensitive and have the following syntax: + * + * [field = value] AND [field [= value]] ... + * + * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label + * key. **value** can be `*` to match all values. + * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. + * Only the logical `AND` operator is supported; space-separated items are + * treated as having an implicit `AND` operator. + * + * Example filter: + * + * status.state = ACTIVE AND labels.env = staging AND labels.starred = * + * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.dataproc.v1.Job|Job}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/job_controller.list_jobs.js + * region_tag:dataproc_v1_generated_JobController_ListJobs_async + */ + listJobsAsync( + request?: protos.google.cloud.dataproc.v1.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'region': request.region ?? '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * Return a fully-qualified nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * Return a fully-qualified projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * 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.jobControllerStub && !this._terminated) { + return this.jobControllerStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json new file mode 100644 index 000000000000..5d75711034e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json @@ -0,0 +1,69 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.JobController": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "SubmitJob": { + "timeout_millis": 900000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SubmitJobAsOperation": { + "timeout_millis": 900000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 900000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "ListJobs": { + "timeout_millis": 900000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 900000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CancelJob": { + "timeout_millis": 900000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 900000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts new file mode 100644 index 000000000000..e9f7c61bd34c --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts @@ -0,0 +1,1428 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/node_group_controller_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './node_group_controller_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The `NodeGroupControllerService` provides methods to manage node groups + * of Compute Engine managed instances. + * @class + * @memberof v1 + */ +export class NodeGroupControllerClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + nodeGroupControllerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of NodeGroupControllerClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 NodeGroupControllerClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof NodeGroupControllerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + clusterRegionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + regionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}' + ), + }; + + 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) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createNodeGroupResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.NodeGroup') as gax.protobuf.Type; + const createNodeGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.NodeGroupOperationMetadata') as gax.protobuf.Type; + const resizeNodeGroupResponse = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.NodeGroup') as gax.protobuf.Type; + const resizeNodeGroupMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.NodeGroupOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNodeGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeGroupResponse.decode.bind(createNodeGroupResponse), + createNodeGroupMetadata.decode.bind(createNodeGroupMetadata)), + resizeNodeGroup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + resizeNodeGroupResponse.decode.bind(resizeNodeGroupResponse), + resizeNodeGroupMetadata.decode.bind(resizeNodeGroupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.NodeGroupController', 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.nodeGroupControllerStub) { + return this.nodeGroupControllerStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.NodeGroupController. + this.nodeGroupControllerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.NodeGroupController') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.NodeGroupController, + 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 nodeGroupControllerStubMethods = + ['createNodeGroup', 'resizeNodeGroup', 'getNodeGroup']; + for (const methodName of nodeGroupControllerStubMethods) { + const callPromise = this.nodeGroupControllerStub.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.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.nodeGroupControllerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 resource representation for a node group in a + * cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the node group to retrieve. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.NodeGroup|NodeGroup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/node_group_controller.get_node_group.js + * region_tag:dataproc_v1_generated_NodeGroupController_GetNodeGroup_async + */ + getNodeGroup( + request?: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|undefined, {}|undefined + ]>; + getNodeGroup( + request: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, + {}|null|undefined>): void; + getNodeGroup( + request: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, + {}|null|undefined>): void; + getNodeGroup( + request?: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.INodeGroup, + protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|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.getNodeGroup(request, options, callback); + } + +/** + * Creates a node group in a cluster. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this node group will be created. + * Format: `projects/{project}/regions/{region}/clusters/{cluster}` + * @param {google.cloud.dataproc.v1.NodeGroup} request.nodeGroup + * Required. The node group to create. + * @param {string} [request.nodeGroupId] + * Optional. An optional node group ID. Generated if not specified. + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). Cannot begin or end with underscore + * or hyphen. Must consist of from 3 to 33 characters. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server receives + * two + * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/node_group_controller.create_node_group.js + * region_tag:dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async + */ + createNodeGroup( + request?: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createNodeGroup( + request: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNodeGroup( + request: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNodeGroup( + request?: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, + 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.createNodeGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createNodeGroup()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/node_group_controller.create_node_group.js + * region_tag:dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async + */ + async checkCreateNodeGroupProgress(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.createNodeGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Resizes a node group in a cluster. The returned + * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} is + * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the node group to resize. + * Format: + * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` + * @param {number} request.size + * Required. The number of running instances for the node group to maintain. + * The group adds or removes instances to maintain the number of instances + * specified by this parameter. + * @param {string} [request.requestId] + * Optional. A unique ID used to identify the request. If the server receives + * two + * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) + * with the same ID, the second request is ignored and the + * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created + * and stored in the backend is returned. + * + * Recommendation: Set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The ID must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {google.protobuf.Duration} [request.gracefulDecommissionTimeout] + * Optional. Timeout for graceful YARN decommissioning. [Graceful + * decommissioning] + * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) + * allows the removal of nodes from the Compute Engine node group + * without interrupting jobs in progress. This timeout specifies how long to + * wait for jobs in progress to finish before forcefully removing nodes (and + * potentially interrupting jobs). Default timeout is 0 (for forceful + * decommission), and the maximum allowed timeout is 1 day. (see JSON + * representation of + * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). + * + * Only supported on Dataproc image versions 1.2 and higher. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/node_group_controller.resize_node_group.js + * region_tag:dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async + */ + resizeNodeGroup( + request?: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + resizeNodeGroup( + request: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resizeNodeGroup( + request: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + resizeNodeGroup( + request?: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, + 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.resizeNodeGroup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `resizeNodeGroup()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/node_group_controller.resize_node_group.js + * region_tag:dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async + */ + async checkResizeNodeGroupProgress(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.resizeNodeGroup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * Return a fully-qualified clusterRegion resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @returns {string} Resource name string. + */ + clusterRegionPath(project:string,region:string,cluster:string) { + return this.pathTemplates.clusterRegionPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + }); + } + + /** + * Parse the project from ClusterRegion resource. + * + * @param {string} clusterRegionName + * A fully-qualified path representing ClusterRegion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClusterRegionName(clusterRegionName: string) { + return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).project; + } + + /** + * Parse the region from ClusterRegion resource. + * + * @param {string} clusterRegionName + * A fully-qualified path representing ClusterRegion resource. + * @returns {string} A string representing the region. + */ + matchRegionFromClusterRegionName(clusterRegionName: string) { + return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).region; + } + + /** + * Parse the cluster from ClusterRegion resource. + * + * @param {string} clusterRegionName + * A fully-qualified path representing ClusterRegion resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromClusterRegionName(clusterRegionName: string) { + return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).cluster; + } + + /** + * Return a fully-qualified nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * 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 projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified region resource name string. + * + * @param {string} project + * @param {string} region + * @returns {string} Resource name string. + */ + regionPath(project:string,region:string) { + return this.pathTemplates.regionPathTemplate.render({ + project: project, + region: region, + }); + } + + /** + * Parse the project from Region resource. + * + * @param {string} regionName + * A fully-qualified path representing Region resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRegionName(regionName: string) { + return this.pathTemplates.regionPathTemplate.match(regionName).project; + } + + /** + * Parse the region from Region resource. + * + * @param {string} regionName + * A fully-qualified path representing Region resource. + * @returns {string} A string representing the region. + */ + matchRegionFromRegionName(regionName: string) { + return this.pathTemplates.regionPathTemplate.match(regionName).region; + } + + /** + * 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.nodeGroupControllerStub && !this._terminated) { + return this.nodeGroupControllerStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json new file mode 100644 index 000000000000..3e7761ab670f --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.NodeGroupController": { + "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": { + "CreateNodeGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResizeNodeGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNodeGroup": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts new file mode 100644 index 000000000000..03d4d8ac8946 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts @@ -0,0 +1,1871 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/workflow_template_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflow_template_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The API interface for managing Workflow Templates in the + * Dataproc API. + * @class + * @memberof v1 + */ +export class WorkflowTemplateServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + workflowTemplateServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkflowTemplateServiceClient. + * + * @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} [options.fallback] - Use HTTP/1.1 REST mode. + * 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 WorkflowTemplateServiceClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WorkflowTemplateServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + + // 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 { + 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 = { + batchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/batches/{batch}' + ), + nodeGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' + ), + projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' + ), + projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' + ), + projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' + ), + regionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}' + ), + }; + + // 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 = { + listWorkflowTemplates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'templates') + }; + + 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) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const instantiateWorkflowTemplateResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const instantiateWorkflowTemplateMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.WorkflowMetadata') as gax.protobuf.Type; + const instantiateInlineWorkflowTemplateResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const instantiateInlineWorkflowTemplateMetadata = protoFilesRoot.lookup( + '.google.cloud.dataproc.v1.WorkflowMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + instantiateWorkflowTemplate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + instantiateWorkflowTemplateResponse.decode.bind(instantiateWorkflowTemplateResponse), + instantiateWorkflowTemplateMetadata.decode.bind(instantiateWorkflowTemplateMetadata)), + instantiateInlineWorkflowTemplate: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + instantiateInlineWorkflowTemplateResponse.decode.bind(instantiateInlineWorkflowTemplateResponse), + instantiateInlineWorkflowTemplateMetadata.decode.bind(instantiateInlineWorkflowTemplateMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dataproc.v1.WorkflowTemplateService', 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.workflowTemplateServiceStub) { + return this.workflowTemplateServiceStub; + } + + // Put together the "service stub" for + // google.cloud.dataproc.v1.WorkflowTemplateService. + this.workflowTemplateServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.WorkflowTemplateService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dataproc.v1.WorkflowTemplateService, + 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 workflowTemplateServiceStubMethods = + ['createWorkflowTemplate', 'getWorkflowTemplate', 'instantiateWorkflowTemplate', 'instantiateInlineWorkflowTemplate', 'updateWorkflowTemplate', 'listWorkflowTemplates', 'deleteWorkflowTemplate']; + for (const methodName of workflowTemplateServiceStubMethods) { + const callPromise = this.workflowTemplateServiceStub.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.workflowTemplateServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dataproc.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 'dataproc.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 -- + // ------------------- +/** + * Creates new workflow template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates.create`, the resource name of the + * region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.workflowTemplates.create`, the resource name of + * the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template + * Required. The Dataproc workflow template to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.create_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async + */ + createWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|undefined, {}|undefined + ]>; + createWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + createWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + createWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|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.createWorkflowTemplate(request, options, callback); + } +/** + * Retrieves the latest workflow template. + * + * Can retrieve previously instantiated template by specifying optional + * version parameter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates.get`, the resource name of the + * template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * + * * For `projects.locations.workflowTemplates.get`, the resource name of the + * template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + * @param {number} [request.version] + * Optional. The version of workflow template to retrieve. Only previously + * instantiated versions can be retrieved. + * + * If unspecified, retrieves the current version. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.get_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async + */ + getWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|undefined, {}|undefined + ]>; + getWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + getWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + getWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|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.getWorkflowTemplate(request, options, callback); + } +/** + * Updates (replaces) workflow template. The updated template + * must contain version that matches the current server version. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template + * Required. The updated workflow template. + * + * The `template.version` field must match the current version. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.update_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_async + */ + updateWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|undefined, {}|undefined + ]>; + updateWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, + callback: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + updateWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate, + protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|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({ + 'template.name': request.template!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkflowTemplate(request, options, callback); + } +/** + * Deletes a workflow template. It does not cancel in-progress workflows. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates.delete`, the resource name + * of the template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * + * * For `projects.locations.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + * @param {number} [request.version] + * Optional. The version of workflow template to delete. If specified, + * will only delete the template if the current server version matches + * specified version. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.delete_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async + */ + deleteWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|undefined, {}|undefined + ]>; + deleteWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|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.deleteWorkflowTemplate(request, options, callback); + } + +/** + * Instantiates a template and begins execution. + * + * The returned Operation can be used to track execution of + * workflow by polling + * {@link protos.google.longrunning.Operations.GetOperation|operations.get}. + * The Operation will complete when entire workflow is finished. + * + * The running workflow can be aborted via + * {@link protos.google.longrunning.Operations.CancelOperation|operations.cancel}. + * This will cause any inflight jobs to be cancelled and workflow-owned + * clusters to be deleted. + * + * The {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). + * Also see [Using + * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). + * + * On successful completion, + * {@link protos.google.longrunning.Operation.response|Operation.response} will be + * {@link protos.google.protobuf.Empty|Empty}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the workflow template, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * + * * For `projects.locations.workflowTemplates.instantiate`, the resource name + * of the template has the following format: + * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + * @param {number} [request.version] + * Optional. The version of workflow template to instantiate. If specified, + * the workflow will be instantiated only if the current version of + * the workflow template has the supplied version. + * + * This option cannot be used to instantiate a previous version of + * workflow template. + * @param {string} [request.requestId] + * Optional. A tag that prevents multiple concurrent workflow + * instances with the same tag from running. This mitigates risk of + * concurrent instances started due to retries. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The tag must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {number[]} [request.parameters] + * Optional. Map from parameter names to values that should be used for those + * parameters. Values may not exceed 1000 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.instantiate_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async + */ + instantiateWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + instantiateWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + instantiateWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + instantiateWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, + 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.instantiateWorkflowTemplate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `instantiateWorkflowTemplate()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.instantiate_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async + */ + async checkInstantiateWorkflowTemplateProgress(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.instantiateWorkflowTemplate, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Instantiates a template and begins execution. + * + * This method is equivalent to executing the sequence + * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate|CreateWorkflowTemplate}, + * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate|InstantiateWorkflowTemplate}, + * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate|DeleteWorkflowTemplate}. + * + * The returned Operation can be used to track execution of + * workflow by polling + * {@link protos.google.longrunning.Operations.GetOperation|operations.get}. + * The Operation will complete when entire workflow is finished. + * + * The running workflow can be aborted via + * {@link protos.google.longrunning.Operations.CancelOperation|operations.cancel}. + * This will cause any inflight jobs to be cancelled and workflow-owned + * clusters to be deleted. + * + * The {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be + * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). + * Also see [Using + * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). + * + * On successful completion, + * {@link protos.google.longrunning.Operation.response|Operation.response} will be + * {@link protos.google.protobuf.Empty|Empty}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates,instantiateinline`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.workflowTemplates.instantiateinline`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template + * Required. The workflow template to instantiate. + * @param {string} [request.requestId] + * Optional. A tag that prevents multiple concurrent workflow + * instances with the same tag from running. This mitigates risk of + * concurrent instances started due to retries. + * + * It is recommended to always set this value to a + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). + * + * The tag must contain only letters (a-z, A-Z), numbers (0-9), + * underscores (_), and hyphens (-). The maximum length is 40 characters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async + */ + instantiateInlineWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + instantiateInlineWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + instantiateInlineWorkflowTemplate( + request: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + instantiateInlineWorkflowTemplate( + request?: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, + 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.instantiateInlineWorkflowTemplate(request, options, callback); + } +/** + * Check the status of the long running operation returned by `instantiateInlineWorkflowTemplate()`. + * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async + */ + async checkInstantiateInlineWorkflowTemplateProgress(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.instantiateInlineWorkflowTemplate, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists workflows that match the specified filter in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates,list`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.workflowTemplates.list`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. + * 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 `listWorkflowTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowTemplates( + request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate[], + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest|null, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse + ]>; + listWorkflowTemplates( + request: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IWorkflowTemplate>): void; + listWorkflowTemplates( + request: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + callback: PaginationCallback< + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IWorkflowTemplate>): void; + listWorkflowTemplates( + request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IWorkflowTemplate>, + callback?: PaginationCallback< + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, + protos.google.cloud.dataproc.v1.IWorkflowTemplate>): + Promise<[ + protos.google.cloud.dataproc.v1.IWorkflowTemplate[], + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest|null, + protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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.listWorkflowTemplates(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 resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates,list`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.workflowTemplates.list`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate} 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 `listWorkflowTemplatesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowTemplatesStream( + request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + 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['listWorkflowTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflowTemplates.createStream( + this.innerApiCalls.listWorkflowTemplates as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkflowTemplates`, 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 resource name of the region or location, as described + * in https://cloud.google.com/apis/design/resource_names. + * + * * For `projects.regions.workflowTemplates,list`, the resource + * name of the region has the following format: + * `projects/{project_id}/regions/{region}` + * + * * For `projects.locations.workflowTemplates.list`, the + * resource name of the location has the following format: + * `projects/{project_id}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in each response. + * @param {string} [request.pageToken] + * Optional. The page token, returned by a previous call, to request the + * next page of 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflow_template_service.list_workflow_templates.js + * region_tag:dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async + */ + listWorkflowTemplatesAsync( + request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, + 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['listWorkflowTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkflowTemplates.asyncIterate( + this.innerApiCalls['listWorkflowTemplates'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified batch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} batch + * @returns {string} Resource name string. + */ + batchPath(project:string,location:string,batch:string) { + return this.pathTemplates.batchPathTemplate.render({ + project: project, + location: location, + batch: batch, + }); + } + + /** + * Parse the project from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).project; + } + + /** + * Parse the location from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).location; + } + + /** + * Parse the batch from Batch resource. + * + * @param {string} batchName + * A fully-qualified path representing Batch resource. + * @returns {string} A string representing the batch. + */ + matchBatchFromBatchName(batchName: string) { + return this.pathTemplates.batchPathTemplate.match(batchName).batch; + } + + /** + * Return a fully-qualified nodeGroup resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} cluster + * @param {string} node_group + * @returns {string} Resource name string. + */ + nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { + return this.pathTemplates.nodeGroupPathTemplate.render({ + project: project, + region: region, + cluster: cluster, + node_group: nodeGroup, + }); + } + + /** + * Parse the project from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; + } + + /** + * Parse the region from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the region. + */ + matchRegionFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; + } + + /** + * Parse the cluster from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; + } + + /** + * Parse the node_group from NodeGroup resource. + * + * @param {string} nodeGroupName + * A fully-qualified path representing NodeGroup resource. + * @returns {string} A string representing the node_group. + */ + matchNodeGroupFromNodeGroupName(nodeGroupName: string) { + return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; + } + + /** + * 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 projectLocationAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ + project: project, + location: location, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; + } + + /** + * Parse the location from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; + } + + /** + * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. + * + * @param {string} projectLocationAutoscalingPolicyName + * A fully-qualified path representing project_location_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { + return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectLocationWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ + project: project, + location: location, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; + } + + /** + * Parse the location from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; + } + + /** + * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. + * + * @param {string} projectLocationWorkflowTemplateName + * A fully-qualified path representing project_location_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { + return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} autoscaling_policy + * @returns {string} Resource name string. + */ + projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ + project: project, + region: region, + autoscaling_policy: autoscalingPolicy, + }); + } + + /** + * Parse the project from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; + } + + /** + * Parse the region from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; + } + + /** + * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. + * + * @param {string} projectRegionAutoscalingPolicyName + * A fully-qualified path representing project_region_autoscaling_policy resource. + * @returns {string} A string representing the autoscaling_policy. + */ + matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { + return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; + } + + /** + * Return a fully-qualified projectRegionWorkflowTemplate resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} workflow_template + * @returns {string} Resource name string. + */ + projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ + project: project, + region: region, + workflow_template: workflowTemplate, + }); + } + + /** + * Parse the project from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; + } + + /** + * Parse the region from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the region. + */ + matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; + } + + /** + * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. + * + * @param {string} projectRegionWorkflowTemplateName + * A fully-qualified path representing project_region_workflow_template resource. + * @returns {string} A string representing the workflow_template. + */ + matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { + return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; + } + + /** + * Return a fully-qualified region resource name string. + * + * @param {string} project + * @param {string} region + * @returns {string} Resource name string. + */ + regionPath(project:string,region:string) { + return this.pathTemplates.regionPathTemplate.render({ + project: project, + region: region, + }); + } + + /** + * Parse the project from Region resource. + * + * @param {string} regionName + * A fully-qualified path representing Region resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRegionName(regionName: string) { + return this.pathTemplates.regionPathTemplate.match(regionName).project; + } + + /** + * Parse the region from Region resource. + * + * @param {string} regionName + * A fully-qualified path representing Region resource. + * @returns {string} A string representing the region. + */ + matchRegionFromRegionName(regionName: string) { + return this.pathTemplates.regionPathTemplate.match(regionName).region; + } + + /** + * 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.workflowTemplateServiceStub && !this._terminated) { + return this.workflowTemplateServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json new file mode 100644 index 000000000000..62d3aa9b9a02 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json @@ -0,0 +1,69 @@ +{ + "interfaces": { + "google.cloud.dataproc.v1.WorkflowTemplateService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ], + "deadline_exceeded_internal_unavailable": [ + "DEADLINE_EXCEEDED", + "INTERNAL", + "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": { + "CreateWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "InstantiateWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "InstantiateInlineWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListWorkflowTemplates": { + "timeout_millis": 600000, + "retry_codes_name": "deadline_exceeded_internal_unavailable", + "retry_params_name": "default" + }, + "DeleteWorkflowTemplate": { + "timeout_millis": 600000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json new file mode 100644 index 000000000000..3bb7ccf055af --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", + "../../protos/google/cloud/dataproc/v1/batches.proto", + "../../protos/google/cloud/dataproc/v1/clusters.proto", + "../../protos/google/cloud/dataproc/v1/jobs.proto", + "../../protos/google/cloud/dataproc/v1/node_groups.proto", + "../../protos/google/cloud/dataproc/v1/operations.proto", + "../../protos/google/cloud/dataproc/v1/shared.proto", + "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" +] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 000000000000..46bd93df71bc --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,32 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const dataproc = require('@google-cloud/dataproc'); + +function main() { + const autoscalingPolicyServiceClient = new dataproc.AutoscalingPolicyServiceClient(); + const batchControllerClient = new dataproc.BatchControllerClient(); + const clusterControllerClient = new dataproc.ClusterControllerClient(); + const jobControllerClient = new dataproc.JobControllerClient(); + const nodeGroupControllerClient = new dataproc.NodeGroupControllerClient(); + const workflowTemplateServiceClient = new dataproc.WorkflowTemplateServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 000000000000..bcccf7df5fd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient} from '@google-cloud/dataproc'; + +// check that the client class type name can be used +function doStuffWithAutoscalingPolicyServiceClient(client: AutoscalingPolicyServiceClient) { + client.close(); +} +function doStuffWithBatchControllerClient(client: BatchControllerClient) { + client.close(); +} +function doStuffWithClusterControllerClient(client: ClusterControllerClient) { + client.close(); +} +function doStuffWithJobControllerClient(client: JobControllerClient) { + client.close(); +} +function doStuffWithNodeGroupControllerClient(client: NodeGroupControllerClient) { + client.close(); +} +function doStuffWithWorkflowTemplateServiceClient(client: WorkflowTemplateServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const autoscalingPolicyServiceClient = new AutoscalingPolicyServiceClient(); + doStuffWithAutoscalingPolicyServiceClient(autoscalingPolicyServiceClient); + // check that the client instance can be created + const batchControllerClient = new BatchControllerClient(); + doStuffWithBatchControllerClient(batchControllerClient); + // check that the client instance can be created + const clusterControllerClient = new ClusterControllerClient(); + doStuffWithClusterControllerClient(clusterControllerClient); + // check that the client instance can be created + const jobControllerClient = new JobControllerClient(); + doStuffWithJobControllerClient(jobControllerClient); + // check that the client instance can be created + const nodeGroupControllerClient = new NodeGroupControllerClient(); + doStuffWithNodeGroupControllerClient(nodeGroupControllerClient); + // check that the client instance can be created + const workflowTemplateServiceClient = new WorkflowTemplateServiceClient(); + doStuffWithWorkflowTemplateServiceClient(workflowTemplateServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts b/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts new file mode 100644 index 000000000000..c8f81b25a865 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts new file mode 100644 index 000000000000..f1e5a2b2b7e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts @@ -0,0 +1,1509 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as autoscalingpolicyserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos} 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 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.AutoscalingPolicyServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.autoscalingPolicyServiceStub, undefined); + await client.initialize(); + assert(client.autoscalingPolicyServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.autoscalingPolicyServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.autoscalingPolicyServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + 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 autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + 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('createAutoscalingPolicy', () => { + it('invokes createAutoscalingPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.createAutoscalingPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.createAutoscalingPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAutoscalingPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.createAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAutoscalingPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAutoscalingPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAutoscalingPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAutoscalingPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAutoscalingPolicy with closed client', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAutoscalingPolicy(request), expectedError); + }); + }); + + describe('updateAutoscalingPolicy', () => { + it('invokes updateAutoscalingPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.updateAutoscalingPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAutoscalingPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAutoscalingPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAutoscalingPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAutoscalingPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAutoscalingPolicy with closed client', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() + ); + request.policy ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); + request.policy.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAutoscalingPolicy(request), expectedError); + }); + }); + + describe('getAutoscalingPolicy', () => { + it('invokes getAutoscalingPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.getAutoscalingPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAutoscalingPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAutoscalingPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.AutoscalingPolicy() + ); + client.innerApiCalls.getAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAutoscalingPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAutoscalingPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAutoscalingPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAutoscalingPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAutoscalingPolicy with closed client', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAutoscalingPolicy(request), expectedError); + }); + }); + + describe('deleteAutoscalingPolicy', () => { + it('invokes deleteAutoscalingPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAutoscalingPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAutoscalingPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAutoscalingPolicy( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAutoscalingPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAutoscalingPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAutoscalingPolicy with closed client', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAutoscalingPolicy(request), expectedError); + }); + }); + + describe('listAutoscalingPolicies', () => { + it('invokes listAutoscalingPolicies without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + ]; + client.innerApiCalls.listAutoscalingPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAutoscalingPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAutoscalingPolicies without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + ]; + client.innerApiCalls.listAutoscalingPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAutoscalingPolicies( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAutoscalingPolicies with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAutoscalingPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAutoscalingPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAutoscalingPoliciesStream without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + ]; + client.descriptors.page.listAutoscalingPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAutoscalingPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.AutoscalingPolicy[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.AutoscalingPolicy) => { + 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.listAutoscalingPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAutoscalingPolicies, request)); + assert( + (client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAutoscalingPoliciesStream with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAutoscalingPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAutoscalingPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.AutoscalingPolicy[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.AutoscalingPolicy) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAutoscalingPolicies, request)); + assert( + (client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAutoscalingPolicies without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), + ]; + client.descriptors.page.listAutoscalingPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[] = []; + const iterable = client.listAutoscalingPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAutoscalingPolicies with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAutoscalingPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAutoscalingPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + 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('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + 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('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts new file mode 100644 index 000000000000..a1cb43b9c6aa --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts @@ -0,0 +1,1714 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as batchcontrollerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos} 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.BatchControllerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = batchcontrollerModule.v1.BatchControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = batchcontrollerModule.v1.BatchControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = batchcontrollerModule.v1.BatchControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new batchcontrollerModule.v1.BatchControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.batchControllerStub, undefined); + await client.initialize(); + assert(client.batchControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.batchControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.batchControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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('getBatch', () => { + it('invokes getBatch without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Batch() + ); + client.innerApiCalls.getBatch = stubSimpleCall(expectedResponse); + const [response] = await client.getBatch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBatch without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Batch() + ); + client.innerApiCalls.getBatch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBatch( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IBatch|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBatch with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBatch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBatch(request), expectedError); + const actualRequest = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBatch with closed client', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBatch(request), expectedError); + }); + }); + + describe('deleteBatch', () => { + it('invokes deleteBatch without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBatch = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBatch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBatch without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBatch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBatch( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBatch with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBatch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBatch(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBatch with closed client', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBatch(request), expectedError); + }); + }); + + describe('createBatch', () => { + it('invokes createBatch without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBatch = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBatch(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBatch without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBatch = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBatch( + 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.createBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBatch with call error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBatch = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBatch(request), expectedError); + const actualRequest = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBatch with LRO error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateBatchRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBatch = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBatch(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBatchProgress without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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.checkCreateBatchProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBatchProgress with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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.checkCreateBatchProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBatches', () => { + it('invokes listBatches without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + ]; + client.innerApiCalls.listBatches = stubSimpleCall(expectedResponse); + const [response] = await client.listBatches(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBatches without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + ]; + client.innerApiCalls.listBatches = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBatches( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IBatch[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBatches with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBatches = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBatches(request), expectedError); + const actualRequest = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBatchesStream without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + ]; + client.descriptors.page.listBatches.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBatchesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Batch[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Batch) => { + 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.listBatches.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBatches, request)); + assert( + (client.descriptors.page.listBatches.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBatchesStream with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBatches.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBatchesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Batch[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Batch) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBatches.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBatches, request)); + assert( + (client.descriptors.page.listBatches.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBatches without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), + ]; + client.descriptors.page.listBatches.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dataproc.v1.IBatch[] = []; + const iterable = client.listBatchesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBatches.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBatches.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBatches with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListBatchesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBatches.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBatchesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dataproc.v1.IBatch[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBatches.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBatches.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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 batchcontrollerModule.v1.BatchControllerClient({ + 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('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + 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('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new batchcontrollerModule.v1.BatchControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts new file mode 100644 index 000000000000..2dbf25dd176a --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts @@ -0,0 +1,2531 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as clustercontrollerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos} 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.ClusterControllerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = clustercontrollerModule.v1.ClusterControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = clustercontrollerModule.v1.ClusterControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = clustercontrollerModule.v1.ClusterControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterControllerStub, undefined); + await client.initialize(); + assert(client.clusterControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.clusterControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.clusterControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Cluster() + ); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + 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.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkCreateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkCreateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + 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.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkUpdateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkUpdateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopCluster', () => { + it('invokes stopCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StopClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StopClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopCluster( + 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.stopCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StopClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StopClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkStopClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkStopClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startCluster', () => { + it('invokes startCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StartClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.startCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StartClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startCluster( + 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.startCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StartClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.StartClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkStartClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkStartClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + 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.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkDeleteClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkDeleteClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('diagnoseCluster', () => { + it('invokes diagnoseCluster without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.diagnoseCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.diagnoseCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes diagnoseCluster without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.diagnoseCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.diagnoseCluster( + 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.diagnoseCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes diagnoseCluster with call error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.diagnoseCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.diagnoseCluster(request), expectedError); + const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes diagnoseCluster with LRO error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); + request.clusterName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.diagnoseCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.diagnoseCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDiagnoseClusterProgress without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkDiagnoseClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDiagnoseClusterProgress with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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.checkDiagnoseClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.ICluster[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClusters with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listClustersStream without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + ]; + client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Cluster[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Cluster) => { + 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.listClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listClustersStream with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Cluster[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Cluster) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listClusters without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), + ]; + client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dataproc.v1.ICluster[] = []; + const iterable = client.listClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listClusters with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListClustersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dataproc.v1.ICluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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 clustercontrollerModule.v1.ClusterControllerClient({ + 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('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new clustercontrollerModule.v1.ClusterControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts new file mode 100644 index 000000000000..5598c8014fde --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts @@ -0,0 +1,2111 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as jobcontrollerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos} 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.JobControllerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = jobcontrollerModule.v1.JobControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = jobcontrollerModule.v1.JobControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = jobcontrollerModule.v1.JobControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new jobcontrollerModule.v1.JobControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.jobControllerStub, undefined); + await client.initialize(); + assert(client.jobControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.jobControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.jobControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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('submitJob', () => { + it('invokes submitJob without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.submitJob = stubSimpleCall(expectedResponse); + const [response] = await client.submitJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJob without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.submitJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.submitJob( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJob with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.submitJob(request), expectedError); + const actualRequest = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJob with closed client', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.submitJob(request), expectedError); + }); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + const actualRequest = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getJob with closed client', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJob(request), expectedError); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + const actualRequest = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateJob with closed client', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateJob(request), expectedError); + }); + }); + + describe('cancelJob', () => { + it('invokes cancelJob without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CancelJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.cancelJob = stubSimpleCall(expectedResponse); + const [response] = await client.cancelJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelJob without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CancelJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.Job() + ); + client.innerApiCalls.cancelJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelJob( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelJob with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CancelJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelJob(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancelJob with closed client', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CancelJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelJob(request), expectedError); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJob with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteJob with closed client', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); + request.region = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); + request.jobId = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteJob(request), expectedError); + }); + }); + + describe('submitJobAsOperation', () => { + it('invokes submitJobAsOperation without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(expectedResponse); + const [operation] = await client.submitJobAsOperation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJobAsOperation without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.submitJobAsOperation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.submitJobAsOperation( + 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.submitJobAsOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJobAsOperation with call error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.submitJobAsOperation(request), expectedError); + const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes submitJobAsOperation with LRO error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.SubmitJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.submitJobAsOperation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSubmitJobAsOperationProgress without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + 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.checkSubmitJobAsOperationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSubmitJobAsOperationProgress with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + 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.checkSubmitJobAsOperationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobs with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + const actualRequest = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Job) => { + 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.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dataproc.v1.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListJobsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); + request.region = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dataproc.v1.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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 jobcontrollerModule.v1.JobControllerClient({ + 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('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new jobcontrollerModule.v1.JobControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts new file mode 100644 index 000000000000..8cec8145d48c --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts @@ -0,0 +1,1534 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as nodegroupcontrollerModule from '../src'; + +import {protobuf, LROperation, operationsProtos, IamProtos} 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 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.NodeGroupControllerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = nodegroupcontrollerModule.v1.NodeGroupControllerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = nodegroupcontrollerModule.v1.NodeGroupControllerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = nodegroupcontrollerModule.v1.NodeGroupControllerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.nodeGroupControllerStub, undefined); + await client.initialize(); + assert(client.nodeGroupControllerStub); + }); + + it('has close method for the initialized client', done => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.nodeGroupControllerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.nodeGroupControllerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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('getNodeGroup', () => { + it('invokes getNodeGroup without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.NodeGroup() + ); + client.innerApiCalls.getNodeGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getNodeGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeGroup without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.NodeGroup() + ); + client.innerApiCalls.getNodeGroup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNodeGroup( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.INodeGroup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeGroup with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNodeGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNodeGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNodeGroup with closed client', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNodeGroup(request), expectedError); + }); + }); + + describe('createNodeGroup', () => { + it('invokes createNodeGroup without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNodeGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNodeGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodeGroup without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNodeGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNodeGroup( + 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.createNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodeGroup with call error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNodeGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createNodeGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNodeGroup with LRO error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNodeGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createNodeGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNodeGroupProgress without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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.checkCreateNodeGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeGroupProgress with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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.checkCreateNodeGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('resizeNodeGroup', () => { + it('invokes resizeNodeGroup without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.resizeNodeGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resizeNodeGroup without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.resizeNodeGroup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resizeNodeGroup( + 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.resizeNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resizeNodeGroup with call error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.resizeNodeGroup(request), expectedError); + const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resizeNodeGroup with LRO error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.resizeNodeGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkResizeNodeGroupProgress without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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.checkResizeNodeGroupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkResizeNodeGroupProgress with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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.checkResizeNodeGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('clusterRegion', () => { + const fakePath = "/rendered/path/clusterRegion"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterRegionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterRegionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterRegionPath', () => { + const result = client.clusterRegionPath("projectValue", "regionValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterRegionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterRegionName', () => { + const result = client.matchProjectFromClusterRegionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromClusterRegionName', () => { + const result = client.matchRegionFromClusterRegionName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterRegionName', () => { + const result = client.matchClusterFromClusterRegionName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + 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('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('region', () => { + const fakePath = "/rendered/path/region"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + }; + const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.regionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.regionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('regionPath', () => { + const result = client.regionPath("projectValue", "regionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.regionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRegionName', () => { + const result = client.matchProjectFromRegionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.regionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromRegionName', () => { + const result = client.matchRegionFromRegionName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.regionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts new file mode 100644 index 000000000000..f20e78e5220e --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts @@ -0,0 +1,2088 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as workflowtemplateserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos} 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.WorkflowTemplateServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowTemplateServiceStub, undefined); + await client.initialize(); + assert(client.workflowTemplateServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowTemplateServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowTemplateServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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('createWorkflowTemplate', () => { + it('invokes createWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.createWorkflowTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.createWorkflowTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.createWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflowTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflowTemplate with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflowTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflowTemplate with closed client', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createWorkflowTemplate(request), expectedError); + }); + }); + + describe('getWorkflowTemplate', () => { + it('invokes getWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.getWorkflowTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflowTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.getWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflowTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflowTemplate with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflowTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflowTemplate with closed client', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkflowTemplate(request), expectedError); + }); + }); + + describe('updateWorkflowTemplate', () => { + it('invokes updateWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() + ); + request.template ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); + request.template.name = defaultValue1; + const expectedHeaderRequestParams = `template.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.updateWorkflowTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.updateWorkflowTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() + ); + request.template ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); + request.template.name = defaultValue1; + const expectedHeaderRequestParams = `template.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dataproc.v1.WorkflowTemplate() + ); + client.innerApiCalls.updateWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflowTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflowTemplate with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() + ); + request.template ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); + request.template.name = defaultValue1; + const expectedHeaderRequestParams = `template.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflowTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflowTemplate with closed client', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() + ); + request.template ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); + request.template.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateWorkflowTemplate(request), expectedError); + }); + }); + + describe('deleteWorkflowTemplate', () => { + it('invokes deleteWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.deleteWorkflowTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflowTemplate( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflowTemplate with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflowTemplate with closed client', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteWorkflowTemplate(request), expectedError); + }); + }); + + describe('instantiateWorkflowTemplate', () => { + it('invokes instantiateWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(expectedResponse); + const [operation] = await client.instantiateWorkflowTemplate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.instantiateWorkflowTemplate( + 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.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateWorkflowTemplate with call error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.instantiateWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateWorkflowTemplate with LRO error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.instantiateWorkflowTemplate(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkInstantiateWorkflowTemplateProgress without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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.checkInstantiateWorkflowTemplateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkInstantiateWorkflowTemplateProgress with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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.checkInstantiateWorkflowTemplateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('instantiateInlineWorkflowTemplate', () => { + it('invokes instantiateInlineWorkflowTemplate without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(expectedResponse); + const [operation] = await client.instantiateInlineWorkflowTemplate(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateInlineWorkflowTemplate without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.instantiateInlineWorkflowTemplate( + 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.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateInlineWorkflowTemplate with call error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.instantiateInlineWorkflowTemplate(request), expectedError); + const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes instantiateInlineWorkflowTemplate with LRO error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.instantiateInlineWorkflowTemplate(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkInstantiateInlineWorkflowTemplateProgress without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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.checkInstantiateInlineWorkflowTemplateProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkInstantiateInlineWorkflowTemplateProgress with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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.checkInstantiateInlineWorkflowTemplateProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listWorkflowTemplates', () => { + it('invokes listWorkflowTemplates without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + ]; + client.innerApiCalls.listWorkflowTemplates = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflowTemplates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowTemplates without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + ]; + client.innerApiCalls.listWorkflowTemplates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflowTemplates( + request, + (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowTemplates with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflowTemplates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkflowTemplates(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowTemplatesStream without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + ]; + client.descriptors.page.listWorkflowTemplates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.WorkflowTemplate[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.WorkflowTemplate) => { + 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.listWorkflowTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflowTemplates, request)); + assert( + (client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listWorkflowTemplatesStream with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflowTemplates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dataproc.v1.WorkflowTemplate[] = []; + stream.on('data', (response: protos.google.cloud.dataproc.v1.WorkflowTemplate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkflowTemplates, request)); + assert( + (client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflowTemplates without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), + ]; + client.descriptors.page.listWorkflowTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dataproc.v1.IWorkflowTemplate[] = []; + const iterable = client.listWorkflowTemplatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listWorkflowTemplates with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflowTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowTemplatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dataproc.v1.IWorkflowTemplate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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('batch', () => { + const fakePath = "/rendered/path/batch"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + batch: "batchValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.batchPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.batchPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('batchPath', () => { + const result = client.batchPath("projectValue", "locationValue", "batchValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.batchPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBatchName', () => { + const result = client.matchProjectFromBatchName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBatchName', () => { + const result = client.matchLocationFromBatchName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBatchFromBatchName', () => { + const result = client.matchBatchFromBatchName(fakePath); + assert.strictEqual(result, "batchValue"); + assert((client.pathTemplates.batchPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('nodeGroup', () => { + const fakePath = "/rendered/path/nodeGroup"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + cluster: "clusterValue", + node_group: "nodeGroupValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodeGroupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodeGroupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodeGroupPath', () => { + const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeGroupName', () => { + const result = client.matchProjectFromNodeGroupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromNodeGroupName', () => { + const result = client.matchRegionFromNodeGroupName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromNodeGroupName', () => { + const result = client.matchClusterFromNodeGroupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeGroupFromNodeGroupName', () => { + const result = client.matchNodeGroupFromNodeGroupName(fakePath); + assert.strictEqual(result, "nodeGroupValue"); + assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + 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('projectLocationAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAutoscalingPolicyPath', () => { + const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + workflow_template: "workflowTemplateValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationWorkflowTemplatePath', () => { + const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionAutoscalingPolicy', () => { + const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + autoscaling_policy: "autoscalingPolicyValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionAutoscalingPolicyPath', () => { + const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { + const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); + assert.strictEqual(result, "autoscalingPolicyValue"); + assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectRegionWorkflowTemplate', () => { + const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + workflow_template: "workflowTemplateValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectRegionWorkflowTemplatePath', () => { + const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { + const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); + assert.strictEqual(result, "workflowTemplateValue"); + assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('region', () => { + const fakePath = "/rendered/path/region"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + }; + const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.regionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.regionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('regionPath', () => { + const result = client.regionPath("projectValue", "regionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.regionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRegionName', () => { + const result = client.matchProjectFromRegionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.regionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromRegionName', () => { + const result = client.matchRegionFromRegionName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.regionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json b/owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json new file mode 100644 index 000000000000..c78f1c884ef6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/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-dataproc/v1/webpack.config.js b/owl-bot-staging/google-cloud-dataproc/v1/webpack.config.js new file mode 100644 index 000000000000..050b272c0e03 --- /dev/null +++ b/owl-bot-staging/google-cloud-dataproc/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: 'dataproc', + filename: './dataproc.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 b42c99919e82bc578330d0b44530f598055fabea Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 15 Sep 2023 01:03:43 +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-dataproc/v1/.eslintignore | 7 - .../google-cloud-dataproc/v1/.eslintrc.json | 3 - .../google-cloud-dataproc/v1/.gitignore | 14 - .../google-cloud-dataproc/v1/.jsdoc.js | 55 - .../google-cloud-dataproc/v1/.mocharc.js | 33 - .../google-cloud-dataproc/v1/.prettierrc.js | 22 - .../google-cloud-dataproc/v1/README.md | 1 - .../google-cloud-dataproc/v1/package.json | 63 - .../dataproc/v1/autoscaling_policies.proto | 381 -- .../google/cloud/dataproc/v1/batches.proto | 403 --- .../google/cloud/dataproc/v1/clusters.proto | 1588 --------- .../google/cloud/dataproc/v1/jobs.proto | 993 ------ .../cloud/dataproc/v1/node_groups.proto | 174 - .../google/cloud/dataproc/v1/operations.proto | 170 - .../google/cloud/dataproc/v1/shared.proto | 476 --- .../dataproc/v1/workflow_templates.proto | 836 ----- ...olicy_service.create_autoscaling_policy.js | 73 - ...olicy_service.delete_autoscaling_policy.js | 68 - ...g_policy_service.get_autoscaling_policy.js | 68 - ...olicy_service.list_autoscaling_policies.js | 80 - ...olicy_service.update_autoscaling_policy.js | 61 - .../v1/batch_controller.create_batch.js | 86 - .../v1/batch_controller.delete_batch.js | 63 - .../v1/batch_controller.get_batch.js | 63 - .../v1/batch_controller.list_batches.js | 93 - .../v1/cluster_controller.create_cluster.js | 90 - .../v1/cluster_controller.delete_cluster.js | 91 - .../v1/cluster_controller.diagnose_cluster.js | 94 - .../v1/cluster_controller.get_cluster.js | 72 - .../v1/cluster_controller.list_clusters.js | 95 - .../v1/cluster_controller.start_cluster.js | 91 - .../v1/cluster_controller.stop_cluster.js | 91 - .../v1/cluster_controller.update_cluster.js | 154 - .../generated/v1/job_controller.cancel_job.js | 72 - .../generated/v1/job_controller.delete_job.js | 72 - .../generated/v1/job_controller.get_job.js | 72 - .../generated/v1/job_controller.list_jobs.js | 102 - .../generated/v1/job_controller.submit_job.js | 85 - .../job_controller.submit_job_as_operation.js | 86 - .../generated/v1/job_controller.update_job.js | 87 - ...node_group_controller.create_node_group.js | 88 - .../node_group_controller.get_node_group.js | 63 - ...node_group_controller.resize_node_group.js | 98 - ...pet_metadata_google.cloud.dataproc.v1.json | 1703 --------- ...mplate_service.create_workflow_template.js | 73 - ...mplate_service.delete_workflow_template.js | 74 - ..._template_service.get_workflow_template.js | 74 - ...ce.instantiate_inline_workflow_template.js | 84 - ...e_service.instantiate_workflow_template.js | 92 - ...emplate_service.list_workflow_templates.js | 79 - ...mplate_service.update_workflow_template.js | 62 - .../google-cloud-dataproc/v1/src/index.ts | 35 - .../v1/autoscaling_policy_service_client.ts | 1374 -------- ...oscaling_policy_service_client_config.json | 51 - ...autoscaling_policy_service_proto_list.json | 10 - .../v1/src/v1/batch_controller_client.ts | 1560 -------- .../v1/batch_controller_client_config.json | 42 - .../src/v1/batch_controller_proto_list.json | 10 - .../v1/src/v1/cluster_controller_client.ts | 2157 ------------ .../v1/cluster_controller_client_config.json | 72 - .../src/v1/cluster_controller_proto_list.json | 10 - .../v1/src/v1/gapic_metadata.json | 453 --- .../google-cloud-dataproc/v1/src/v1/index.ts | 24 - .../v1/src/v1/job_controller_client.ts | 1775 ---------- .../src/v1/job_controller_client_config.json | 69 - .../v1/src/v1/job_controller_proto_list.json | 10 - .../v1/src/v1/node_group_controller_client.ts | 1428 -------- .../node_group_controller_client_config.json | 38 - .../v1/node_group_controller_proto_list.json | 10 - .../v1/workflow_template_service_client.ts | 1871 ---------- ...rkflow_template_service_client_config.json | 69 - .../workflow_template_service_proto_list.json | 10 - .../system-test/fixtures/sample/src/index.js | 32 - .../system-test/fixtures/sample/src/index.ts | 62 - .../v1/system-test/install.ts | 49 - .../gapic_autoscaling_policy_service_v1.ts | 1509 -------- .../v1/test/gapic_batch_controller_v1.ts | 1714 --------- .../v1/test/gapic_cluster_controller_v1.ts | 2531 ------------- .../v1/test/gapic_job_controller_v1.ts | 2111 ----------- .../v1/test/gapic_node_group_controller_v1.ts | 1534 -------- .../gapic_workflow_template_service_v1.ts | 2088 ----------- .../google-cloud-dataproc/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../google/cloud/dataproc/v1/clusters.proto | 55 +- .../google-cloud-dataproc/protos/protos.d.ts | 1362 ++++++- .../google-cloud-dataproc/protos/protos.js | 3132 ++++++++++++++--- .../google-cloud-dataproc/protos/protos.json | 126 + .../v1/cluster_controller.diagnose_cluster.js | 21 + ...pet_metadata_google.cloud.dataproc.v1.json | 18 +- .../src/v1/cluster_controller_client.ts | 13 + 90 files changed, 4085 insertions(+), 33151 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-dataproc/v1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.eslintignore b/owl-bot-staging/google-cloud-dataproc/v1/.eslintignore deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/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-dataproc/v1/.eslintrc.json b/owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json deleted file mode 100644 index 782153495464..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.gitignore b/owl-bot-staging/google-cloud-dataproc/v1/.gitignore deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/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-dataproc/v1/.jsdoc.js b/owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js deleted file mode 100644 index 725b542ad92f..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dataproc', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js b/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js deleted file mode 100644 index 1a38f257db70..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js b/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9ea..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/README.md b/owl-bot-staging/google-cloud-dataproc/v1/README.md deleted file mode 100644 index 3e8aa9dfae5f..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Dataproc: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dataproc/v1/package.json b/owl-bot-staging/google-cloud-dataproc/v1/package.json deleted file mode 100644 index 058457b6724d..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@google-cloud/dataproc", - "version": "0.1.0", - "description": "Dataproc client for Node.js", - "repository": "googleapis/nodejs-dataproc", - "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 dataproc", - "dataproc", - "autoscaling policy service", - "batch controller", - "cluster controller", - "job controller", - "node group controller", - "workflow template service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "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": "^4.0.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.16", - "c8": "^8.0.1", - "gapic-tools": "^0.1.8", - "gts": "5.0.1", - "jsdoc": "^4.0.2", - "jsdoc-region-tag": "^3.0.0", - "jsdoc-fresh": "^3.0.0", - "mocha": "^10.2.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.2.0", - "typescript": "5.1.6" - }, - "engines": { - "node": ">=v14" - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto deleted file mode 100644 index 123cd73e24e0..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/autoscaling_policies.proto +++ /dev/null @@ -1,381 +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.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "AutoscalingPoliciesProto"; -option java_package = "com.google.cloud.dataproc.v1"; -option (google.api.resource_definition) = { - type: "dataproc.googleapis.com/Region" - pattern: "projects/{project}/regions/{region}" -}; - -// The API interface for managing autoscaling policies in the -// Dataproc API. -service AutoscalingPolicyService { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates new autoscaling policy. - rpc CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest) - returns (AutoscalingPolicy) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/autoscalingPolicies" - body: "policy" - additional_bindings { - post: "/v1/{parent=projects/*/regions/*}/autoscalingPolicies" - body: "policy" - } - }; - option (google.api.method_signature) = "parent,policy"; - } - - // Updates (replaces) autoscaling policy. - // - // Disabled check for update_mask, because all updates will be full - // replacements. - rpc UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest) - returns (AutoscalingPolicy) { - option (google.api.http) = { - put: "/v1/{policy.name=projects/*/locations/*/autoscalingPolicies/*}" - body: "policy" - additional_bindings { - put: "/v1/{policy.name=projects/*/regions/*/autoscalingPolicies/*}" - body: "policy" - } - }; - option (google.api.method_signature) = "policy"; - } - - // Retrieves autoscaling policy. - rpc GetAutoscalingPolicy(GetAutoscalingPolicyRequest) - returns (AutoscalingPolicy) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/autoscalingPolicies/*}" - additional_bindings { - get: "/v1/{name=projects/*/regions/*/autoscalingPolicies/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists autoscaling policies in the project. - rpc ListAutoscalingPolicies(ListAutoscalingPoliciesRequest) - returns (ListAutoscalingPoliciesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/autoscalingPolicies" - additional_bindings { - get: "/v1/{parent=projects/*/regions/*}/autoscalingPolicies" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an autoscaling policy. It is an error to delete an autoscaling - // policy that is in use by one or more clusters. - rpc DeleteAutoscalingPolicy(DeleteAutoscalingPolicyRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/autoscalingPolicies/*}" - additional_bindings { - delete: "/v1/{name=projects/*/regions/*/autoscalingPolicies/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// Describes an autoscaling policy for Dataproc cluster autoscaler. -message AutoscalingPolicy { - option (google.api.resource) = { - type: "dataproc.googleapis.com/AutoscalingPolicy" - pattern: "projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}" - pattern: "projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}" - }; - - // Required. The policy id. - // - // The id must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). Cannot begin or end with underscore - // or hyphen. Must consist of between 3 and 50 characters. - // - string id = 1; - - // Output only. The "resource name" of the autoscaling policy, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.autoscalingPolicies`, the resource name of the - // policy has the following format: - // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - // - // * For `projects.locations.autoscalingPolicies`, the resource name of the - // policy has the following format: - // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - string name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Autoscaling algorithm for policy. - oneof algorithm { - BasicAutoscalingAlgorithm basic_algorithm = 3 - [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Describes how the autoscaler will operate for primary workers. - InstanceGroupAutoscalingPolicyConfig worker_config = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Describes how the autoscaler will operate for secondary workers. - InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels to associate with this autoscaling policy. - // Label **keys** must contain 1 to 63 characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // Label **values** may be empty, but, if present, must contain 1 to 63 - // characters, and must conform to [RFC - // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be - // associated with an autoscaling policy. - map labels = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Basic algorithm for autoscaling. -message BasicAutoscalingAlgorithm { - oneof config { - // Required. YARN autoscaling configuration. - BasicYarnAutoscalingConfig yarn_config = 1 - [(google.api.field_behavior) = REQUIRED]; - } - - // Optional. Duration between scaling events. A scaling period starts after - // the update operation from the previous event has completed. - // - // Bounds: [2m, 1d]. Default: 2m. - google.protobuf.Duration cooldown_period = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Basic autoscaling configurations for YARN. -message BasicYarnAutoscalingConfig { - // Required. Timeout for YARN graceful decommissioning of Node Managers. - // Specifies the duration to wait for jobs to complete before forcefully - // removing workers (and potentially interrupting jobs). Only applicable to - // downscaling operations. - // - // Bounds: [0s, 1d]. - google.protobuf.Duration graceful_decommission_timeout = 5 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Fraction of average YARN pending memory in the last cooldown - // period for which to add workers. A scale-up factor of 1.0 will result in - // scaling up so that there is no pending memory remaining after the update - // (more aggressive scaling). A scale-up factor closer to 0 will result in a - // smaller magnitude of scaling up (less aggressive scaling). See [How - // autoscaling - // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) - // for more information. - // - // Bounds: [0.0, 1.0]. - double scale_up_factor = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Fraction of average YARN pending memory in the last cooldown - // period for which to remove workers. A scale-down factor of 1 will result in - // scaling down so that there is no available memory remaining after the - // update (more aggressive scaling). A scale-down factor of 0 disables - // removing workers, which can be beneficial for autoscaling a single job. - // See [How autoscaling - // works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) - // for more information. - // - // Bounds: [0.0, 1.0]. - double scale_down_factor = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Minimum scale-up threshold as a fraction of total cluster size - // before scaling occurs. For example, in a 20-worker cluster, a threshold of - // 0.1 means the autoscaler must recommend at least a 2-worker scale-up for - // the cluster to scale. A threshold of 0 means the autoscaler will scale up - // on any recommended change. - // - // Bounds: [0.0, 1.0]. Default: 0.0. - double scale_up_min_worker_fraction = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Minimum scale-down threshold as a fraction of total cluster size - // before scaling occurs. For example, in a 20-worker cluster, a threshold of - // 0.1 means the autoscaler must recommend at least a 2 worker scale-down for - // the cluster to scale. A threshold of 0 means the autoscaler will scale down - // on any recommended change. - // - // Bounds: [0.0, 1.0]. Default: 0.0. - double scale_down_min_worker_fraction = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for the size bounds of an instance group, including its -// proportional size to other groups. -message InstanceGroupAutoscalingPolicyConfig { - // Optional. Minimum number of instances for this group. - // - // Primary workers - Bounds: [2, max_instances]. Default: 2. - // Secondary workers - Bounds: [0, max_instances]. Default: 0. - int32 min_instances = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Maximum number of instances for this group. Required for primary - // workers. Note that by default, clusters will not use secondary workers. - // Required for secondary workers if the minimum secondary instances is set. - // - // Primary workers - Bounds: [min_instances, ). - // Secondary workers - Bounds: [min_instances, ). Default: 0. - int32 max_instances = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Weight for the instance group, which is used to determine the - // fraction of total workers in the cluster from this instance group. - // For example, if primary workers have weight 2, and secondary workers have - // weight 1, the cluster will have approximately 2 primary workers for each - // secondary worker. - // - // The cluster may not reach the specified balance if constrained - // by min/max bounds or other autoscaling settings. For example, if - // `max_instances` for secondary workers is 0, then only primary workers will - // be added. The cluster can also be out of balance when created. - // - // If weight is not set on any instance group, the cluster will default to - // equal weight for all groups: the cluster will attempt to maintain an equal - // number of workers in each group within the configured size bounds for each - // group. If weight is set for one group only, the cluster will default to - // zero weight on the unset group. For example if weight is set only on - // primary workers, the cluster will use primary workers only and no - // secondary workers. - int32 weight = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to create an autoscaling policy. -message CreateAutoscalingPolicyRequest { - // Required. The "resource name" of the region or location, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.autoscalingPolicies.create`, the resource name - // of the region has the following format: - // `projects/{project_id}/regions/{region}` - // - // * For `projects.locations.autoscalingPolicies.create`, the resource name - // of the location has the following format: - // `projects/{project_id}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/AutoscalingPolicy" - } - ]; - - // Required. The autoscaling policy to create. - AutoscalingPolicy policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to fetch an autoscaling policy. -message GetAutoscalingPolicyRequest { - // Required. The "resource name" of the autoscaling policy, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.autoscalingPolicies.get`, the resource name - // of the policy has the following format: - // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - // - // * For `projects.locations.autoscalingPolicies.get`, the resource name - // of the policy has the following format: - // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/AutoscalingPolicy" - } - ]; -} - -// A request to update an autoscaling policy. -message UpdateAutoscalingPolicyRequest { - // Required. The updated autoscaling policy. - AutoscalingPolicy policy = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to delete an autoscaling policy. -// -// Autoscaling policies in use by one or more clusters will not be deleted. -message DeleteAutoscalingPolicyRequest { - // Required. The "resource name" of the autoscaling policy, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.autoscalingPolicies.delete`, the resource name - // of the policy has the following format: - // `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - // - // * For `projects.locations.autoscalingPolicies.delete`, the resource name - // of the policy has the following format: - // `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/AutoscalingPolicy" - } - ]; -} - -// A request to list autoscaling policies in a project. -message ListAutoscalingPoliciesRequest { - // Required. The "resource name" of the region or location, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.autoscalingPolicies.list`, the resource name - // of the region has the following format: - // `projects/{project_id}/regions/{region}` - // - // * For `projects.locations.autoscalingPolicies.list`, the resource name - // of the location has the following format: - // `projects/{project_id}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/AutoscalingPolicy" - } - ]; - - // Optional. The maximum number of results to return in each response. - // Must be less than or equal to 1000. Defaults to 100. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The page token, returned by a previous call, to request the - // next page of results. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A response to a request to list autoscaling policies in a project. -message ListAutoscalingPoliciesResponse { - // Output only. Autoscaling policies list. - repeated AutoscalingPolicy policies = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This token is included in the response if there are more - // results to fetch. - string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto deleted file mode 100644 index 56d73f5c8843..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/batches.proto +++ /dev/null @@ -1,403 +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.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dataproc/v1/shared.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "BatchesProto"; -option java_package = "com.google.cloud.dataproc.v1"; - -// The BatchController provides methods to manage batch workloads. -service BatchController { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a batch workload that executes asynchronously. - rpc CreateBatch(CreateBatchRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/batches" - body: "batch" - }; - option (google.api.method_signature) = "parent,batch,batch_id"; - option (google.longrunning.operation_info) = { - response_type: "Batch" - metadata_type: "google.cloud.dataproc.v1.BatchOperationMetadata" - }; - } - - // Gets the batch workload resource representation. - rpc GetBatch(GetBatchRequest) returns (Batch) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/batches/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists batch workloads. - rpc ListBatches(ListBatchesRequest) returns (ListBatchesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/batches" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes the batch workload resource. If the batch is not in terminal state, - // the delete fails and the response returns `FAILED_PRECONDITION`. - rpc DeleteBatch(DeleteBatchRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/batches/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// A request to create a batch workload. -message CreateBatchRequest { - // Required. The parent resource where this batch will be created. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/Batch" - } - ]; - - // Required. The batch to create. - Batch batch = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The ID to use for the batch, which will become the final - // component of the batch's resource name. - // - // This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`. - string batch_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique ID used to identify the request. If the service - // receives two - // [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s - // with the same request_id, the second request is ignored and the - // Operation that corresponds to the first Batch created and stored - // in the backend is returned. - // - // Recommendation: Set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The value must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get the resource representation for a batch workload. -message GetBatchRequest { - // Required. The fully qualified name of the batch to retrieve - // in the format - // "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "dataproc.googleapis.com/Batch" } - ]; -} - -// A request to list batch workloads in a project. -message ListBatchesRequest { - // Required. The parent, which owns this collection of batches. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/Batch" - } - ]; - - // Optional. The maximum number of batches to return in each response. - // The service may return fewer than this value. - // The default page size is 20; the maximum page size is 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token received from a previous `ListBatches` call. - // Provide this token to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter for the batches to return in the response. - // - // A filter is a logical expression constraining the values of various fields - // in each batch resource. Filters are case sensitive, and may contain - // multiple clauses combined with logical operators (AND/OR). - // Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. - // - // e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` - // filters for batches in state RUNNING that were created before 2023-01-01 - // - // See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed - // description of the filter syntax and a list of supported comparisons. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field(s) on which to sort the list of batches. - // - // Currently the only supported sort orders are unspecified (empty) and - // `create_time desc` to sort by most recently created batches first. - // - // See https://google.aip.dev/132#ordering for more details. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// A list of batch workloads. -message ListBatchesResponse { - // The batches from the specified collection. - repeated Batch batches = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// A request to delete a batch workload. -message DeleteBatchRequest { - // Required. The fully qualified name of the batch to retrieve - // in the format - // "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "dataproc.googleapis.com/Batch" } - ]; -} - -// A representation of a batch workload in the service. -message Batch { - option (google.api.resource) = { - type: "dataproc.googleapis.com/Batch" - pattern: "projects/{project}/locations/{location}/batches/{batch}" - }; - - // The batch state. - enum State { - // The batch state is unknown. - STATE_UNSPECIFIED = 0; - - // The batch is created before running. - PENDING = 1; - - // The batch is running. - RUNNING = 2; - - // The batch is cancelling. - CANCELLING = 3; - - // The batch cancellation was successful. - CANCELLED = 4; - - // The batch completed successfully. - SUCCEEDED = 5; - - // The batch is no longer running due to an error. - FAILED = 6; - } - - // Historical state information. - message StateHistory { - // Output only. The state of the batch at this point in history. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Details about the state at this point in history. - string state_message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the batch entered the historical state. - google.protobuf.Timestamp state_start_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The resource name of the batch. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A batch UUID (Unique Universal Identifier). The service - // generates this value when it creates the batch. - string uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the batch was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The application/framework-specific portion of the batch configuration. - oneof batch_config { - // Optional. PySpark batch config. - PySparkBatch pyspark_batch = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Spark batch config. - SparkBatch spark_batch = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. SparkR batch config. - SparkRBatch spark_r_batch = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. SparkSql batch config. - SparkSqlBatch spark_sql_batch = 7 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. Runtime information about batch execution. - RuntimeInfo runtime_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of the batch. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Batch state details, such as a failure - // description if the state is `FAILED`. - string state_message = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the batch entered a current state. - google.protobuf.Timestamp state_time = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The email address of the user who created the batch. - string creator = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The labels to associate with this batch. - // Label **keys** must contain 1 to 63 characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // Label **values** may be empty, but, if present, must contain 1 to 63 - // characters, and must conform to [RFC - // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be - // associated with a batch. - map labels = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Runtime configuration for the batch execution. - RuntimeConfig runtime_config = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Environment configuration for the batch execution. - EnvironmentConfig environment_config = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The resource name of the operation associated with this batch. - string operation = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Historical state information for the batch. - repeated StateHistory state_history = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A configuration for running an -// [Apache -// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html) -// batch workload. -message PySparkBatch { - // Required. The HCFS URI of the main Python file to use as the Spark driver. - // Must be a .py file. - string main_python_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The arguments to pass to the driver. Do not include arguments - // that can be set as batch properties, such as `--conf`, since a collision - // can occur that causes an incorrect batch submission. - repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS file URIs of Python files to pass to the PySpark - // framework. Supported file types: `.py`, `.egg`, and `.zip`. - repeated string python_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the classpath of the - // Spark driver and tasks. - repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. - repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. - repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A configuration for running an [Apache Spark](https://spark.apache.org/) -// batch workload. -message SparkBatch { - // The specification of the main method to call to drive the Spark - // workload. Specify either the jar file that contains the main class or the - // main class name. To pass both a main jar and a main class in that jar, add - // the jar to `jar_file_uris`, and then specify the main class - // name in `main_class`. - oneof driver { - // Optional. The HCFS URI of the jar file that contains the main class. - string main_jar_file_uri = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the driver main class. The jar file that contains - // the class must be in the classpath or specified in `jar_file_uris`. - string main_class = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The arguments to pass to the driver. Do not include arguments - // that can be set as batch properties, such as `--conf`, since a collision - // can occur that causes an incorrect batch submission. - repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the classpath of the - // Spark driver and tasks. - repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. - repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. - repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A configuration for running an -// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html) -// batch workload. -message SparkRBatch { - // Required. The HCFS URI of the main R file to use as the driver. - // Must be a `.R` or `.r` file. - string main_r_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The arguments to pass to the Spark driver. Do not include - // arguments that can be set as batch properties, such as `--conf`, since a - // collision can occur that causes an incorrect batch submission. - repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. - repeated string file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`. - repeated string archive_uris = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A configuration for running -// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch -// workload. -message SparkSqlBatch { - // Required. The HCFS URI of the script that contains Spark SQL queries to - // execute. - string query_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Mapping of query variable names to values (equivalent to the - // Spark SQL command: `SET name="value";`). - map query_variables = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. - repeated string jar_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto deleted file mode 100644 index 03a4e8d60061..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/clusters.proto +++ /dev/null @@ -1,1588 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dataproc/v1/shared.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/interval.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "ClustersProto"; -option java_package = "com.google.cloud.dataproc.v1"; - -// The ClusterControllerService provides methods to manage clusters -// of Compute Engine instances. -service ClusterController { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a cluster in a project. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] will be - // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - rpc CreateCluster(CreateClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/clusters" - body: "cluster" - }; - option (google.api.method_signature) = "project_id,region,cluster"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } - - // Updates a cluster in a project. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] will be - // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - // The cluster must be in a - // [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error - // is returned. - rpc UpdateCluster(UpdateClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" - body: "cluster" - }; - option (google.api.method_signature) = - "project_id,region,cluster_name,cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } - - // Stops a cluster in a project. - rpc StopCluster(StopClusterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:stop" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } - - // Starts a cluster in a project. - rpc StartCluster(StartClusterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:start" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } - - // Deletes a cluster in a project. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] will be - // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - rpc DeleteCluster(DeleteClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" - }; - option (google.api.method_signature) = "project_id,region,cluster_name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } - - // Gets the resource representation for a cluster in a project. - rpc GetCluster(GetClusterRequest) returns (Cluster) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}" - }; - option (google.api.method_signature) = "project_id,region,cluster_name"; - } - - // Lists all regions/{region}/clusters in a project alphabetically. - rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/regions/{region}/clusters" - }; - option (google.api.method_signature) = "project_id,region"; - option (google.api.method_signature) = "project_id,region,filter"; - } - - // Gets cluster diagnostic information. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] will be - // [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - // After the operation completes, - // [Operation.response][google.longrunning.Operation.response] - // contains - // [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). - rpc DiagnoseCluster(DiagnoseClusterRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:diagnose" - body: "*" - }; - option (google.api.method_signature) = "project_id,region,cluster_name"; - option (google.longrunning.operation_info) = { - response_type: "DiagnoseClusterResults" - metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata" - }; - } -} - -// Describes the identifying information, config, and status of -// a Dataproc cluster -message Cluster { - // Required. The Google Cloud Platform project ID that the cluster belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name, which must be unique within a project. - // The name must start with a lowercase letter, and can contain - // up to 51 lowercase letters, numbers, and hyphens. It cannot end - // with a hyphen. The name of a deleted cluster can be reused. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The cluster config for a cluster of Compute Engine Instances. - // Note that Dataproc may set default values, and values may change - // when clusters are updated. - // - // Exactly one of ClusterConfig or VirtualClusterConfig must be specified. - ClusterConfig config = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The virtual cluster config is used when creating a Dataproc - // cluster that does not directly control the underlying compute resources, - // for example, when creating a [Dataproc-on-GKE - // cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). - // Dataproc may set default values, and values may change when - // clusters are updated. Exactly one of - // [config][google.cloud.dataproc.v1.Cluster.config] or - // [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config] - // must be specified. - VirtualClusterConfig virtual_cluster_config = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels to associate with this cluster. - // Label **keys** must contain 1 to 63 characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // Label **values** may be empty, but, if present, must contain 1 to 63 - // characters, and must conform to [RFC - // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be - // associated with a cluster. - map labels = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Cluster status. - ClusterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The previous cluster status. - repeated ClusterStatus status_history = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A cluster UUID (Unique Universal Identifier). Dataproc - // generates this value when it creates the cluster. - string cluster_uuid = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains cluster daemon metrics such as HDFS and YARN stats. - // - // **Beta Feature**: This report is available for testing purposes only. It - // may be changed before final release. - ClusterMetrics metrics = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The cluster config. -message ClusterConfig { - // Optional. A Cloud Storage bucket used to stage job - // dependencies, config files, and job driver console output. - // If you do not specify a staging bucket, Cloud - // Dataproc will determine a Cloud Storage location (US, - // ASIA, or EU) for your cluster's staging bucket according to the - // Compute Engine zone where your cluster is deployed, and then create - // and manage this project-level, per-location bucket (see - // [Dataproc staging and temp - // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). - // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to - // a Cloud Storage bucket.** - string config_bucket = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs - // data, such as Spark and MapReduce history files. If you do not specify a - // temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or - // EU) for your cluster's temp bucket according to the Compute Engine zone - // where your cluster is deployed, and then create and manage this - // project-level, per-location bucket. The default bucket has a TTL of 90 - // days, but you can use any TTL (or none) if you specify a bucket (see - // [Dataproc staging and temp - // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). - // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to - // a Cloud Storage bucket.** - string temp_bucket = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The shared Compute Engine config settings for - // all instances in a cluster. - GceClusterConfig gce_cluster_config = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine config settings for - // the cluster's master instance. - InstanceGroupConfig master_config = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine config settings for - // the cluster's worker instances. - InstanceGroupConfig worker_config = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine config settings for - // a cluster's secondary worker instances - InstanceGroupConfig secondary_worker_config = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The config settings for cluster software. - SoftwareConfig software_config = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Commands to execute on each node after config is - // completed. By default, executables are run on master and all worker nodes. - // You can test a node's `role` metadata to run an executable on - // a master or worker node, as shown below using `curl` (you can also use - // `wget`): - // - // ROLE=$(curl -H Metadata-Flavor:Google - // http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) - // if [[ "${ROLE}" == 'Master' ]]; then - // ... master specific actions ... - // else - // ... worker specific actions ... - // fi - repeated NodeInitializationAction initialization_actions = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Encryption settings for the cluster. - EncryptionConfig encryption_config = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Autoscaling config for the policy associated with the cluster. - // Cluster does not autoscale if this field is unset. - AutoscalingConfig autoscaling_config = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Security settings for the cluster. - SecurityConfig security_config = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lifecycle setting for the cluster. - LifecycleConfig lifecycle_config = 17 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Port/endpoint configuration for this cluster - EndpointConfig endpoint_config = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Metastore configuration. - MetastoreConfig metastore_config = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The config for Dataproc metrics. - DataprocMetricConfig dataproc_metric_config = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The node group settings. - repeated AuxiliaryNodeGroup auxiliary_node_groups = 25 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The Dataproc cluster config for a cluster that does not directly control the -// underlying compute resources, such as a [Dataproc-on-GKE -// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). -message VirtualClusterConfig { - // Optional. A Cloud Storage bucket used to stage job - // dependencies, config files, and job driver console output. - // If you do not specify a staging bucket, Cloud - // Dataproc will determine a Cloud Storage location (US, - // ASIA, or EU) for your cluster's staging bucket according to the - // Compute Engine zone where your cluster is deployed, and then create - // and manage this project-level, per-location bucket (see - // [Dataproc staging and temp - // buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). - // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to - // a Cloud Storage bucket.** - string staging_bucket = 1 [(google.api.field_behavior) = OPTIONAL]; - - oneof infrastructure_config { - // Required. The configuration for running the Dataproc cluster on - // Kubernetes. - KubernetesClusterConfig kubernetes_cluster_config = 6 - [(google.api.field_behavior) = REQUIRED]; - } - - // Optional. Configuration of auxiliary services used by this cluster. - AuxiliaryServicesConfig auxiliary_services_config = 7 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Auxiliary services configuration for a Cluster. -message AuxiliaryServicesConfig { - // Optional. The Hive Metastore configuration for this workload. - MetastoreConfig metastore_config = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Spark History Server configuration for the workload. - SparkHistoryServerConfig spark_history_server_config = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Endpoint config for this cluster -message EndpointConfig { - // Output only. The map of port descriptions to URLs. Will only be populated - // if enable_http_port_access is true. - map http_ports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. If true, enable http access to specific ports on the cluster - // from external sources. Defaults to false. - bool enable_http_port_access = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Autoscaling Policy config associated with the cluster. -message AutoscalingConfig { - // Optional. The autoscaling policy used by the cluster. - // - // Only resource names including projectid and location (region) are valid. - // Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]` - // * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]` - // - // Note that the policy must be in the same project and Dataproc region. - string policy_uri = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Encryption settings for the cluster. -message EncryptionConfig { - // Optional. The Cloud KMS key name to use for PD disk encryption for all - // instances in the cluster. - string gce_pd_kms_key_name = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Common config settings for resources of Compute Engine cluster -// instances, applicable to all instances in the cluster. -message GceClusterConfig { - // `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes - // can communicate with Google Services through gRPC over IPv6. - // These values are directly mapped to corresponding values in the - // [Compute Engine Instance - // fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances). - enum PrivateIpv6GoogleAccess { - // If unspecified, Compute Engine default behavior will apply, which - // is the same as - // [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]. - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0; - - // Private access to and from Google Services configuration - // inherited from the subnetwork configuration. This is the - // default Compute Engine behavior. - INHERIT_FROM_SUBNETWORK = 1; - - // Enables outbound private IPv6 access to Google Services from the Dataproc - // cluster. - OUTBOUND = 2; - - // Enables bidirectional private IPv6 access between Google Services and the - // Dataproc cluster. - BIDIRECTIONAL = 3; - } - - // Optional. The Compute Engine zone where the Dataproc cluster will be - // located. If omitted, the service will pick a zone in the cluster's Compute - // Engine region. On a get request, zone will always be present. - // - // A full URL, partial URI, or short name are valid. Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]` - // * `projects/[project_id]/zones/[zone]` - // * `[zone]` - string zone_uri = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine network to be used for machine - // communications. Cannot be specified with subnetwork_uri. If neither - // `network_uri` nor `subnetwork_uri` is specified, the "default" network of - // the project is used, if it exists. Cannot be a "Custom Subnet Network" (see - // [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for - // more information). - // - // A full URL, partial URI, or short name are valid. Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/networks/default` - // * `projects/[project_id]/global/networks/default` - // * `default` - string network_uri = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine subnetwork to be used for machine - // communications. Cannot be specified with network_uri. - // - // A full URL, partial URI, or short name are valid. Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/[region]/subnetworks/sub0` - // * `projects/[project_id]/regions/[region]/subnetworks/sub0` - // * `sub0` - string subnetwork_uri = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, all instances in the cluster will only have internal IP - // addresses. By default, clusters are not restricted to internal IP - // addresses, and will have ephemeral external IP addresses assigned to each - // instance. This `internal_ip_only` restriction can only be enabled for - // subnetwork enabled networks, and all off-cluster dependencies must be - // configured to be accessible without external IP addresses. - optional bool internal_ip_only = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of IPv6 access for a cluster. - PrivateIpv6GoogleAccess private_ipv6_google_access = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [Dataproc service - // account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc) - // (also see [VM Data Plane - // identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity)) - // used by Dataproc cluster VM instances to access Google Cloud Platform - // services. - // - // If not specified, the - // [Compute Engine default service - // account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) - // is used. - string service_account = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The URIs of service account scopes to be included in - // Compute Engine instances. The following base set of scopes is always - // included: - // - // * https://www.googleapis.com/auth/cloud.useraccounts.readonly - // * https://www.googleapis.com/auth/devstorage.read_write - // * https://www.googleapis.com/auth/logging.write - // - // If no scopes are specified, the following defaults are also provided: - // - // * https://www.googleapis.com/auth/bigquery - // * https://www.googleapis.com/auth/bigtable.admin.table - // * https://www.googleapis.com/auth/bigtable.data - // * https://www.googleapis.com/auth/devstorage.full_control - repeated string service_account_scopes = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // The Compute Engine tags to add to all instances (see [Tagging - // instances](https://cloud.google.com/compute/docs/label-or-tag-resources#tags)). - repeated string tags = 4; - - // Optional. The Compute Engine metadata entries to add to all instances (see - // [Project and instance - // metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)). - map metadata = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Reservation Affinity for consuming Zonal reservation. - ReservationAffinity reservation_affinity = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Node Group Affinity for sole-tenant clusters. - NodeGroupAffinity node_group_affinity = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Shielded Instance Config for clusters using [Compute Engine - // Shielded - // VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). - ShieldedInstanceConfig shielded_instance_config = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Confidential Instance Config for clusters using [Confidential - // VMs](https://cloud.google.com/compute/confidential-vm/docs). - ConfidentialInstanceConfig confidential_instance_config = 15 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Node Group Affinity for clusters using sole-tenant node groups. -// **The Dataproc `NodeGroupAffinity` resource is not related to the -// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.** -message NodeGroupAffinity { - // Required. The URI of a - // sole-tenant [node group - // resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups) - // that the cluster will be created on. - // - // A full URL, partial URI, or node group name are valid. Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/nodeGroups/node-group-1` - // * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1` - // * `node-group-1` - string node_group_uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Shielded Instance Config for clusters using [Compute Engine Shielded -// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm). -message ShieldedInstanceConfig { - // Optional. Defines whether instances have Secure Boot enabled. - optional bool enable_secure_boot = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines whether instances have the vTPM enabled. - optional bool enable_vtpm = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines whether instances have integrity monitoring enabled. - optional bool enable_integrity_monitoring = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Confidential Instance Config for clusters using [Confidential -// VMs](https://cloud.google.com/compute/confidential-vm/docs) -message ConfidentialInstanceConfig { - // Optional. Defines whether the instance should have confidential compute - // enabled. - bool enable_confidential_compute = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// The config settings for Compute Engine resources in -// an instance group, such as a master or worker group. -message InstanceGroupConfig { - // Controls the use of preemptible instances within the group. - enum Preemptibility { - // Preemptibility is unspecified, the system will choose the - // appropriate setting for each instance group. - PREEMPTIBILITY_UNSPECIFIED = 0; - - // Instances are non-preemptible. - // - // This option is allowed for all instance groups and is the only valid - // value for Master and Worker instance groups. - NON_PREEMPTIBLE = 1; - - // Instances are [preemptible] - // (https://cloud.google.com/compute/docs/instances/preemptible). - // - // This option is allowed only for [secondary worker] - // (https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms) - // groups. - PREEMPTIBLE = 2; - - // Instances are [Spot VMs] - // (https://cloud.google.com/compute/docs/instances/spot). - // - // This option is allowed only for [secondary worker] - // (https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms) - // groups. Spot VMs are the latest version of [preemptible VMs] - // (https://cloud.google.com/compute/docs/instances/preemptible), and - // provide additional features. - SPOT = 3; - } - - // Optional. The number of VM instances in the instance group. - // For [HA - // cluster](/dataproc/docs/concepts/configuring-clusters/high-availability) - // [master_config](#FIELDS.master_config) groups, **must be set to 3**. - // For standard cluster [master_config](#FIELDS.master_config) groups, - // **must be set to 1**. - int32 num_instances = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The list of instance names. Dataproc derives the names - // from `cluster_name`, `num_instances`, and the instance group. - repeated string instance_names = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. List of references to Compute Engine instances. - repeated InstanceReference instance_references = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The Compute Engine image resource used for cluster instances. - // - // The URI can represent an image or image family. - // - // Image examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/[image-id]` - // * `projects/[project_id]/global/images/[image-id]` - // * `image-id` - // - // Image family examples. Dataproc will use the most recent - // image from the family: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/family/[custom-image-family-name]` - // * `projects/[project_id]/global/images/family/[custom-image-family-name]` - // - // If the URI is unspecified, it will be inferred from - // `SoftwareConfig.image_version` or the system default. - string image_uri = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Compute Engine machine type used for cluster instances. - // - // A full URL, partial URI, or short name are valid. Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2` - // * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2` - // * `n1-standard-2` - // - // **Auto Zone Exception**: If you are using the Dataproc - // [Auto Zone - // Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) - // feature, you must use the short name of the machine type - // resource, for example, `n1-standard-2`. - string machine_type_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Disk option config settings. - DiskConfig disk_config = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Specifies that this instance group contains preemptible - // instances. - bool is_preemptible = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Specifies the preemptibility of the instance group. - // - // The default value for master and worker groups is - // `NON_PREEMPTIBLE`. This default cannot be changed. - // - // The default value for secondary instances is - // `PREEMPTIBLE`. - Preemptibility preemptibility = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The config for Compute Engine Instance Group - // Manager that manages this group. - // This is only used for preemptible instance groups. - ManagedGroupConfig managed_group_config = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The Compute Engine accelerator configuration for these - // instances. - repeated AcceleratorConfig accelerators = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the minimum cpu platform for the Instance Group. - // See [Dataproc -> Minimum CPU - // Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu). - string min_cpu_platform = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The minimum number of primary worker instances to create. - // If `min_num_instances` is set, cluster creation will succeed if - // the number of primary workers created is at least equal to the - // `min_num_instances` number. - // - // Example: Cluster creation request with `num_instances` = `5` and - // `min_num_instances` = `3`: - // - // * If 4 VMs are created and 1 instance fails, - // the failed VM is deleted. The cluster is - // resized to 4 instances and placed in a `RUNNING` state. - // * If 2 instances are created and 3 instances fail, - // the cluster in placed in an `ERROR` state. The failed VMs - // are not deleted. - int32 min_num_instances = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Instance flexibility Policy allowing a mixture of VM shapes and - // provisioning models. - InstanceFlexibilityPolicy instance_flexibility_policy = 13 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A reference to a Compute Engine instance. -message InstanceReference { - // The user-friendly name of the Compute Engine instance. - string instance_name = 1; - - // The unique identifier of the Compute Engine instance. - string instance_id = 2; - - // The public RSA key used for sharing data with this instance. - string public_key = 3; - - // The public ECIES key used for sharing data with this instance. - string public_ecies_key = 4; -} - -// Specifies the resources used to actively manage an instance group. -message ManagedGroupConfig { - // Output only. The name of the Instance Template used for the Managed - // Instance Group. - string instance_template_name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the Instance Group Manager for this group. - string instance_group_manager_name = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The partial URI to the instance group manager for this group. - // E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm. - string instance_group_manager_uri = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Instance flexibility Policy allowing a mixture of VM shapes and provisioning -// models. -message InstanceFlexibilityPolicy { - // Defines machines types and a rank to which the machines types belong. - message InstanceSelection { - // Optional. Full machine-type names, e.g. "n1-standard-16". - repeated string machine_types = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Preference of this instance selection. Lower number means - // higher preference. Dataproc will first try to create a VM based on the - // machine-type with priority rank and fallback to next rank based on - // availability. Machine types and instance selections with the same - // priority have the same preference. - int32 rank = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Defines a mapping from machine types to the number of VMs that are created - // with each machine type. - message InstanceSelectionResult { - // Output only. Full machine-type names, e.g. "n1-standard-16". - optional string machine_type = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of VM provisioned with the machine_type. - optional int32 vm_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Optional. List of instance selection options that the group will use when - // creating new VMs. - repeated InstanceSelection instance_selection_list = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A list of instance selection results in the group. - repeated InstanceSelectionResult instance_selection_results = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Specifies the type and number of accelerator cards attached to the instances -// of an instance. See [GPUs on Compute -// Engine](https://cloud.google.com/compute/docs/gpus/). -message AcceleratorConfig { - // Full URL, partial URI, or short name of the accelerator type resource to - // expose to this instance. See - // [Compute Engine - // AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes). - // - // Examples: - // - // * `https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-k80` - // * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-k80` - // * `nvidia-tesla-k80` - // - // **Auto Zone Exception**: If you are using the Dataproc - // [Auto Zone - // Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) - // feature, you must use the short name of the accelerator type - // resource, for example, `nvidia-tesla-k80`. - string accelerator_type_uri = 1; - - // The number of the accelerator cards of this type exposed to this instance. - int32 accelerator_count = 2; -} - -// Specifies the config of disk options for a group of VM instances. -message DiskConfig { - // Optional. Type of the boot disk (default is "pd-standard"). - // Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive), - // "pd-ssd" (Persistent Disk Solid State Drive), - // or "pd-standard" (Persistent Disk Hard Disk Drive). - // See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types). - string boot_disk_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Size in GB of the boot disk (default is 500GB). - int32 boot_disk_size_gb = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Number of attached SSDs, from 0 to 8 (default is 0). - // If SSDs are not attached, the boot disk is used to store runtime logs and - // [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. - // If one or more SSDs are attached, this runtime bulk - // data is spread across them, and the boot disk contains only basic - // config and installed binaries. - // - // Note: Local SSD options may vary by machine type and number of vCPUs - // selected. - int32 num_local_ssds = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Interface type of local SSDs (default is "scsi"). - // Valid values: "scsi" (Small Computer System Interface), - // "nvme" (Non-Volatile Memory Express). - // See [local SSD - // performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance). - string local_ssd_interface = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Node group identification and configuration information. -message AuxiliaryNodeGroup { - // Required. Node group configuration. - NodeGroup node_group = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A node group ID. Generated if not specified. - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). Cannot begin or end with underscore - // or hyphen. Must consist of from 3 to 33 characters. - string node_group_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Dataproc Node Group. -// **The Dataproc `NodeGroup` resource is not related to the -// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity] -// resource.** -message NodeGroup { - option (google.api.resource) = { - type: "dataproc.googleapis.com/NodeGroup" - pattern: "projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}" - }; - - // Node pool roles. - enum Role { - // Required unspecified role. - ROLE_UNSPECIFIED = 0; - - // Job drivers run on the node pool. - DRIVER = 1; - } - - // The Node group [resource name](https://aip.dev/122). - string name = 1; - - // Required. Node group roles. - repeated Role roles = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The node group instance group configuration. - InstanceGroupConfig node_group_config = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Node group labels. - // - // * Label **keys** must consist of from 1 to 63 characters and conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // * Label **values** can be empty. If specified, they must consist of from - // 1 to 63 characters and conform to [RFC 1035] - // (https://www.ietf.org/rfc/rfc1035.txt). - // * The node group must have no more than 32 labels. - map labels = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Specifies an executable to run on a fully configured node and a -// timeout period for executable completion. -message NodeInitializationAction { - // Required. Cloud Storage URI of executable file. - string executable_file = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Amount of time executable has to complete. Default is - // 10 minutes (see JSON representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // - // Cluster creation fails with an explanatory error message (the - // name of the executable that caused the error and the exceeded timeout - // period) if the executable is not completed at end of the timeout period. - google.protobuf.Duration execution_timeout = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The status of a cluster and its instances. -message ClusterStatus { - // The cluster state. - enum State { - // The cluster state is unknown. - UNKNOWN = 0; - - // The cluster is being created and set up. It is not ready for use. - CREATING = 1; - - // The cluster is currently running and healthy. It is ready for use. - // - // **Note:** The cluster state changes from "creating" to "running" status - // after the master node(s), first two primary worker nodes (and the last - // primary worker node if primary workers > 2) are running. - RUNNING = 2; - - // The cluster encountered an error. It is not ready for use. - ERROR = 3; - - // The cluster has encountered an error while being updated. Jobs can - // be submitted to the cluster, but the cluster cannot be updated. - ERROR_DUE_TO_UPDATE = 9; - - // The cluster is being deleted. It cannot be used. - DELETING = 4; - - // The cluster is being updated. It continues to accept and process jobs. - UPDATING = 5; - - // The cluster is being stopped. It cannot be used. - STOPPING = 6; - - // The cluster is currently stopped. It is not ready for use. - STOPPED = 7; - - // The cluster is being started. It is not ready for use. - STARTING = 8; - - // The cluster is being repaired. It is not ready for use. - REPAIRING = 10; - } - - // The cluster substate. - enum Substate { - // The cluster substate is unknown. - UNSPECIFIED = 0; - - // The cluster is known to be in an unhealthy state - // (for example, critical daemons are not running or HDFS capacity is - // exhausted). - // - // Applies to RUNNING state. - UNHEALTHY = 1; - - // The agent-reported status is out of date (may occur if - // Dataproc loses communication with Agent). - // - // Applies to RUNNING state. - STALE_STATUS = 2; - } - - // Output only. The cluster's state. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. Details of cluster's state. - string detail = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Output only. Time when this state was entered (see JSON representation of - // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Timestamp state_start_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional state information that includes - // status reported by the agent. - Substate substate = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Security related configuration, including encryption, Kerberos, etc. -message SecurityConfig { - // Optional. Kerberos related configuration. - KerberosConfig kerberos_config = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Identity related configuration, including service account based - // secure multi-tenancy user mappings. - IdentityConfig identity_config = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Specifies Kerberos related configuration. -message KerberosConfig { - // Optional. Flag to indicate whether to Kerberize the cluster (default: - // false). Set this field to true to enable Kerberos on a cluster. - bool enable_kerberos = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the root - // principal password. - string root_principal_password_uri = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The uri of the KMS key used to encrypt various sensitive - // files. - string kms_key_uri = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of the keystore file used for SSL - // encryption. If not provided, Dataproc will provide a self-signed - // certificate. - string keystore_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of the truststore file used for SSL - // encryption. If not provided, Dataproc will provide a self-signed - // certificate. - string truststore_uri = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the - // password to the user provided keystore. For the self-signed certificate, - // this password is generated by Dataproc. - string keystore_password_uri = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the - // password to the user provided key. For the self-signed certificate, this - // password is generated by Dataproc. - string key_password_uri = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the - // password to the user provided truststore. For the self-signed certificate, - // this password is generated by Dataproc. - string truststore_password_uri = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The remote realm the Dataproc on-cluster KDC will trust, should - // the user enable cross realm trust. - string cross_realm_trust_realm = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The KDC (IP or hostname) for the remote trusted realm in a cross - // realm trust relationship. - string cross_realm_trust_kdc = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The admin server (IP or hostname) for the remote trusted realm in - // a cross realm trust relationship. - string cross_realm_trust_admin_server = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the - // shared password between the on-cluster Kerberos realm and the remote - // trusted realm, in a cross realm trust relationship. - string cross_realm_trust_shared_password_uri = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud Storage URI of a KMS encrypted file containing the - // master key of the KDC database. - string kdc_db_key_uri = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The lifetime of the ticket granting ticket, in hours. - // If not specified, or user specifies 0, then default value 10 - // will be used. - int32 tgt_lifetime_hours = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the on-cluster Kerberos realm. - // If not specified, the uppercased domain of hostnames will be the realm. - string realm = 15 [(google.api.field_behavior) = OPTIONAL]; -} - -// Identity related configuration, including service account based -// secure multi-tenancy user mappings. -message IdentityConfig { - // Required. Map of user to service account. - map user_service_account_mapping = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies the selection and config of software inside the cluster. -message SoftwareConfig { - // Optional. The version of software inside the cluster. It must be one of the - // supported [Dataproc - // Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions), - // such as "1.2" (including a subminor version, such as "1.2.29"), or the - // ["preview" - // version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions). - // If unspecified, it defaults to the latest Debian version. - string image_version = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The properties to set on daemon config files. - // - // Property keys are specified in `prefix:property` format, for example - // `core:hadoop.tmp.dir`. The following are supported prefixes - // and their mappings: - // - // * capacity-scheduler: `capacity-scheduler.xml` - // * core: `core-site.xml` - // * distcp: `distcp-default.xml` - // * hdfs: `hdfs-site.xml` - // * hive: `hive-site.xml` - // * mapred: `mapred-site.xml` - // * pig: `pig.properties` - // * spark: `spark-defaults.conf` - // * yarn: `yarn-site.xml` - // - // For more information, see [Cluster - // properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties). - map properties = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The set of components to activate on the cluster. - repeated Component optional_components = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Specifies the cluster auto-delete schedule configuration. -message LifecycleConfig { - // Optional. The duration to keep the cluster alive while idling (when no jobs - // are running). Passing this threshold will cause the cluster to be - // deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON - // representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Duration idle_delete_ttl = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Either the exact time the cluster should be deleted at or - // the cluster maximum age. - oneof ttl { - // Optional. The time when cluster will be auto-deleted (see JSON - // representation of - // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Timestamp auto_delete_time = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The lifetime duration of cluster. The cluster will be - // auto-deleted at the end of this period. Minimum value is 10 minutes; - // maximum value is 14 days (see JSON representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Duration auto_delete_ttl = 3 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The time when cluster became idle (most recent job finished) - // and became eligible for deletion due to idleness (see JSON representation - // of - // [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Timestamp idle_start_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Specifies a Metastore configuration. -message MetastoreConfig { - // Required. Resource name of an existing Dataproc Metastore service. - // - // Example: - // - // * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]` - string dataproc_metastore_service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Contains cluster daemon metrics, such as HDFS and YARN stats. -// -// **Beta Feature**: This report is available for testing purposes only. It may -// be changed before final release. -message ClusterMetrics { - // The HDFS metrics. - map hdfs_metrics = 1; - - // YARN metrics. - map yarn_metrics = 2; -} - -// Dataproc metric config. -message DataprocMetricConfig { - // A source for the collection of Dataproc custom metrics (see [Custom - // metrics] - // (https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics)). - enum MetricSource { - // Required unspecified metric source. - METRIC_SOURCE_UNSPECIFIED = 0; - - // Monitoring agent metrics. If this source is enabled, - // Dataproc enables the monitoring agent in Compute Engine, - // and collects monitoring agent metrics, which are published - // with an `agent.googleapis.com` prefix. - MONITORING_AGENT_DEFAULTS = 1; - - // HDFS metric source. - HDFS = 2; - - // Spark metric source. - SPARK = 3; - - // YARN metric source. - YARN = 4; - - // Spark History Server metric source. - SPARK_HISTORY_SERVER = 5; - - // Hiveserver2 metric source. - HIVESERVER2 = 6; - - // hivemetastore metric source - HIVEMETASTORE = 7; - } - - // A Dataproc custom metric. - message Metric { - // Required. A standard set of metrics is collected unless `metricOverrides` - // are specified for the metric source (see [Custom metrics] - // (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) - // for more information). - MetricSource metric_source = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specify one or more [Custom metrics] - // (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) - // to collect for the metric course (for the `SPARK` metric source (any - // [Spark metric] - // (https://spark.apache.org/docs/latest/monitoring.html#metrics) can be - // specified). - // - // Provide metrics in the following format: - // METRIC_SOURCE:INSTANCE:GROUP:METRIC - // Use camelcase as appropriate. - // - // Examples: - // - // ``` - // yarn:ResourceManager:QueueMetrics:AppsCompleted - // spark:driver:DAGScheduler:job.allJobs - // sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed - // hiveserver2:JVM:Memory:NonHeapMemoryUsage.used - // ``` - // - // Notes: - // - // * Only the specified overridden metrics are collected for the - // metric source. For example, if one or more `spark:executive` metrics - // are listed as metric overrides, other `SPARK` metrics are not - // collected. The collection of the metrics for other enabled custom - // metric sources is unaffected. For example, if both `SPARK` andd `YARN` - // metric sources are enabled, and overrides are provided for Spark - // metrics only, all YARN metrics are collected. - repeated string metric_overrides = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. Metrics sources to enable. - repeated Metric metrics = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to create a cluster. -message CreateClusterRequest { - // Required. The ID of the Google Cloud Platform project that the cluster - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster to create. - Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique ID used to identify the request. If the server receives - // two - // [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s - // with the same id, then the second request will be ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Failure action when primary worker creation fails. - FailureAction action_on_failed_primary_workers = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a cluster. -message UpdateClusterRequest { - // Required. The ID of the Google Cloud Platform project the - // cluster belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The changes to the cluster. - Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Timeout for graceful YARN decommissioning. Graceful - // decommissioning allows removing nodes from the cluster without - // interrupting jobs in progress. Timeout specifies how long to wait for jobs - // in progress to finish before forcefully removing nodes (and potentially - // interrupting jobs). Default timeout is 0 (for forceful decommission), and - // the maximum allowed timeout is 1 day. (see JSON representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // - // Only supported on Dataproc image versions 1.2 and higher. - google.protobuf.Duration graceful_decommission_timeout = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. Specifies the path, relative to `Cluster`, of - // the field to update. For example, to change the number of workers - // in a cluster to 5, the `update_mask` parameter would be - // specified as `config.worker_config.num_instances`, - // and the `PATCH` request body would specify the new value, as follows: - // - // { - // "config":{ - // "workerConfig":{ - // "numInstances":"5" - // } - // } - // } - // Similarly, to change the number of preemptible workers in a cluster to 5, - // the `update_mask` parameter would be - // `config.secondary_worker_config.num_instances`, and the `PATCH` request - // body would be set as follows: - // - // { - // "config":{ - // "secondaryWorkerConfig":{ - // "numInstances":"5" - // } - // } - // } - // Note: Currently, only the following fields can be updated: - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - //
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or - // change autoscaling policies
- google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique ID used to identify the request. If the server - // receives two - // [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s - // with the same id, then the second request will be ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to stop a cluster. -message StopClusterRequest { - // Required. The ID of the Google Cloud Platform project the - // cluster belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifying the `cluster_uuid` means the RPC will fail - // (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique ID used to identify the request. If the server - // receives two - // [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s - // with the same id, then the second request will be ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // Recommendation: Set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to start a cluster. -message StartClusterRequest { - // Required. The ID of the Google Cloud Platform project the - // cluster belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifying the `cluster_uuid` means the RPC will fail - // (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique ID used to identify the request. If the server - // receives two - // [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s - // with the same id, then the second request will be ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // Recommendation: Set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to delete a cluster. -message DeleteClusterRequest { - // Required. The ID of the Google Cloud Platform project that the cluster - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifying the `cluster_uuid` means the RPC should fail - // (with error NOT_FOUND) if cluster with specified UUID does not exist. - string cluster_uuid = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique ID used to identify the request. If the server - // receives two - // [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s - // with the same id, then the second request will be ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request to get the resource representation for a cluster in a project. -message GetClusterRequest { - // Required. The ID of the Google Cloud Platform project that the cluster - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to list the clusters in a project. -message ListClustersRequest { - // Required. The ID of the Google Cloud Platform project that the cluster - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A filter constraining the clusters to list. Filters are - // case-sensitive and have the following syntax: - // - // field = value [AND [field = value]] ... - // - // where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, - // and `[KEY]` is a label key. **value** can be `*` to match all values. - // `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, - // `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` - // contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` - // contains the `DELETING` and `ERROR` states. - // `clusterName` is the name of the cluster provided at creation time. - // Only the logical `AND` operator is supported; space-separated items are - // treated as having an implicit `AND` operator. - // - // Example filter: - // - // status.state = ACTIVE AND clusterName = mycluster - // AND labels.env = staging AND labels.starred = * - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The standard List page size. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The standard List page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The list of all clusters in a project. -message ListClustersResponse { - // Output only. The clusters in the project. - repeated Cluster clusters = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This token is included in the response if there are more - // results to fetch. To fetch additional results, provide this value as the - // `page_token` in a subsequent `ListClustersRequest`. - string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request to collect cluster diagnostic information. -message DiagnoseClusterRequest { - // Required. The ID of the Google Cloud Platform project that the cluster - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster name. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The output Cloud Storage directory for the diagnostic - // tarball. If not specified, a task-specific directory in the cluster's - // staging bucket will be used. - string tarball_gcs_dir = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Time interval in which diagnosis should be carried out on the - // cluster. - google.type.Interval diagnosis_interval = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a list of jobs on which diagnosis is to be performed. - // Format: projects/{project}/regions/{region}/jobs/{job} - repeated string jobs = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a list of yarn applications on which diagnosis is to be - // performed. - repeated string yarn_application_ids = 11 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The location of diagnostic output. -message DiagnoseClusterResults { - // Output only. The Cloud Storage URI of the diagnostic output. - // The output report is a plain text file with a summary of collected - // diagnostics. - string output_uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Reservation Affinity for consuming Zonal reservation. -message ReservationAffinity { - // Indicates whether to consume capacity from an reservation or not. - enum Type { - TYPE_UNSPECIFIED = 0; - - // Do not consume from any allocated capacity. - NO_RESERVATION = 1; - - // Consume any reservation available. - ANY_RESERVATION = 2; - - // Must consume from a specific reservation. Must specify key value fields - // for specifying the reservations. - SPECIFIC_RESERVATION = 3; - } - - // Optional. Type of reservation to consume - Type consume_reservation_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Corresponds to the label key of reservation resource. - string key = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Corresponds to the label values of reservation resource. - repeated string values = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto deleted file mode 100644 index 061cccc6c23a..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/jobs.proto +++ /dev/null @@ -1,993 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "JobsProto"; -option java_package = "com.google.cloud.dataproc.v1"; - -// The JobController provides methods to manage jobs. -service JobController { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Submits a job to a cluster. - rpc SubmitJob(SubmitJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/jobs:submit" - body: "*" - }; - option (google.api.method_signature) = "project_id,region,job"; - } - - // Submits job to a cluster. - rpc SubmitJobAsOperation(SubmitJobRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/jobs:submitAsOperation" - body: "*" - }; - option (google.api.method_signature) = "project_id, region, job"; - option (google.longrunning.operation_info) = { - response_type: "Job" - metadata_type: "JobMetadata" - }; - } - - // Gets the resource representation for a job in a project. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" - }; - option (google.api.method_signature) = "project_id,region,job_id"; - } - - // Lists regions/{region}/jobs in a project. - rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/regions/{region}/jobs" - }; - option (google.api.method_signature) = "project_id,region"; - option (google.api.method_signature) = "project_id,region,filter"; - } - - // Updates a job in a project. - rpc UpdateJob(UpdateJobRequest) returns (Job) { - option (google.api.http) = { - patch: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" - body: "job" - }; - } - - // Starts a job cancellation request. To access the job resource - // after cancellation, call - // [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) - // or - // [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). - rpc CancelJob(CancelJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}:cancel" - body: "*" - }; - option (google.api.method_signature) = "project_id,region,job_id"; - } - - // Deletes the job from the project. If the job is active, the delete fails, - // and the response returns `FAILED_PRECONDITION`. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/projects/{project_id}/regions/{region}/jobs/{job_id}" - }; - option (google.api.method_signature) = "project_id,region,job_id"; - } -} - -// The runtime logging config of the job. -message LoggingConfig { - // The Log4j level for job execution. When running an - // [Apache Hive](https://hive.apache.org/) job, Cloud - // Dataproc configures the Hive client to an equivalent verbosity level. - enum Level { - // Level is unspecified. Use default level for log4j. - LEVEL_UNSPECIFIED = 0; - - // Use ALL level for log4j. - ALL = 1; - - // Use TRACE level for log4j. - TRACE = 2; - - // Use DEBUG level for log4j. - DEBUG = 3; - - // Use INFO level for log4j. - INFO = 4; - - // Use WARN level for log4j. - WARN = 5; - - // Use ERROR level for log4j. - ERROR = 6; - - // Use FATAL level for log4j. - FATAL = 7; - - // Turn off log4j. - OFF = 8; - } - - // The per-package log levels for the driver. This may include - // "root" package name to configure rootLogger. - // Examples: - // - 'com.google = FATAL' - // - 'root = INFO' - // - 'org.apache = DEBUG' - map driver_log_levels = 2; -} - -// A Dataproc job for running -// [Apache Hadoop -// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) -// jobs on [Apache Hadoop -// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html). -message HadoopJob { - // Required. Indicates the location of the driver's main class. Specify - // either the jar file that contains the main class or the main class name. - // To specify both, add the jar file to `jar_file_uris`, and then specify - // the main class name in this property. - oneof driver { - // The HCFS URI of the jar file containing the main class. - // Examples: - // 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar' - // 'hdfs:/tmp/test-samples/custom-wordcount.jar' - // 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar' - string main_jar_file_uri = 1; - - // The name of the driver's main class. The jar file containing the class - // must be in the default CLASSPATH or specified in `jar_file_uris`. - string main_class = 2; - } - - // Optional. The arguments to pass to the driver. Do not - // include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as - // job properties, since a collision may occur that causes an incorrect job - // submission. - repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Jar file URIs to add to the CLASSPATHs of the - // Hadoop driver and tasks. - repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied - // to the working directory of Hadoop drivers and distributed tasks. Useful - // for naively parallel tasks. - repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted in the working directory of - // Hadoop drivers and tasks. Supported file types: - // .jar, .tar, .tar.gz, .tgz, or .zip. - repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure Hadoop. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and - // classes in user code. - map properties = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running [Apache Spark](https://spark.apache.org/) -// applications on YARN. -message SparkJob { - // Required. The specification of the main method to call to drive the job. - // Specify either the jar file that contains the main class or the main class - // name. To pass both a main jar and a main class in that jar, add the jar to - // `CommonJob.jar_file_uris`, and then specify the main class name in - // `main_class`. - oneof driver { - // The HCFS URI of the jar file that contains the main class. - string main_jar_file_uri = 1; - - // The name of the driver's main class. The jar file that contains the class - // must be in the default CLASSPATH or specified in `jar_file_uris`. - string main_class = 2; - } - - // Optional. The arguments to pass to the driver. Do not include arguments, - // such as `--conf`, that can be set as job properties, since a collision may - // occur that causes an incorrect job submission. - repeated string args = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the CLASSPATHs of the - // Spark driver and tasks. - repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. Useful for naively parallel tasks. - repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // .jar, .tar, .tar.gz, .tgz, and .zip. - repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure Spark. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in - // /etc/spark/conf/spark-defaults.conf and classes in user code. - map properties = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running -// [Apache -// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html) -// applications on YARN. -message PySparkJob { - // Required. The HCFS URI of the main Python file to use as the driver. Must - // be a .py file. - string main_python_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The arguments to pass to the driver. Do not include arguments, - // such as `--conf`, that can be set as job properties, since a collision may - // occur that causes an incorrect job submission. - repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS file URIs of Python files to pass to the PySpark - // framework. Supported file types: .py, .egg, and .zip. - repeated string python_file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the CLASSPATHs of the - // Python driver and tasks. - repeated string jar_file_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. Useful for naively parallel tasks. - repeated string file_uris = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // .jar, .tar, .tar.gz, .tgz, and .zip. - repeated string archive_uris = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure PySpark. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in - // /etc/spark/conf/spark-defaults.conf and classes in user code. - map properties = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// A list of queries to run on a cluster. -message QueryList { - // Required. The queries to execute. You do not need to end a query expression - // with a semicolon. Multiple queries can be specified in one - // string by separating each with a semicolon. Here is an example of a - // Dataproc API snippet that uses a QueryList to specify a HiveJob: - // - // "hiveJob": { - // "queryList": { - // "queries": [ - // "query1", - // "query2", - // "query3;query4", - // ] - // } - // } - repeated string queries = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A Dataproc job for running [Apache Hive](https://hive.apache.org/) -// queries on YARN. -message HiveJob { - // Required. The sequence of Hive queries to execute, specified as either - // an HCFS file URI or a list of queries. - oneof queries { - // The HCFS URI of the script that contains Hive queries. - string query_file_uri = 1; - - // A list of queries. - QueryList query_list = 2; - } - - // Optional. Whether to continue executing queries if a query fails. - // The default value is `false`. Setting to `true` can be useful when - // executing independent parallel queries. - bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Mapping of query variable names to values (equivalent to the - // Hive command: `SET name="value";`). - map script_variables = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names and values, used to configure Hive. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`, - // /etc/hive/conf/hive-site.xml, and classes in user code. - map properties = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the CLASSPATH of the - // Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes - // and UDFs. - repeated string jar_file_uris = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running [Apache Spark -// SQL](https://spark.apache.org/sql/) queries. -message SparkSqlJob { - // Required. The sequence of Spark SQL queries to execute, specified as - // either an HCFS file URI or as a list of queries. - oneof queries { - // The HCFS URI of the script that contains SQL queries. - string query_file_uri = 1; - - // A list of queries. - QueryList query_list = 2; - } - - // Optional. Mapping of query variable names to values (equivalent to the - // Spark SQL command: SET `name="value";`). - map script_variables = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure - // Spark SQL's SparkConf. Properties that conflict with values set by the - // Dataproc API may be overwritten. - map properties = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. - repeated string jar_file_uris = 56 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running [Apache Pig](https://pig.apache.org/) -// queries on YARN. -message PigJob { - // Required. The sequence of Pig queries to execute, specified as an HCFS - // file URI or a list of queries. - oneof queries { - // The HCFS URI of the script that contains the Pig queries. - string query_file_uri = 1; - - // A list of queries. - QueryList query_list = 2; - } - - // Optional. Whether to continue executing queries if a query fails. - // The default value is `false`. Setting to `true` can be useful when - // executing independent parallel queries. - bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Mapping of query variable names to values (equivalent to the Pig - // command: `name=[value]`). - map script_variables = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure Pig. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`, - // /etc/pig/conf/pig.properties, and classes in user code. - map properties = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of jar files to add to the CLASSPATH of - // the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs. - repeated string jar_file_uris = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running -// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html) -// applications on YARN. -message SparkRJob { - // Required. The HCFS URI of the main R file to use as the driver. - // Must be a .R file. - string main_r_file_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The arguments to pass to the driver. Do not include arguments, - // such as `--conf`, that can be set as job properties, since a collision may - // occur that causes an incorrect job submission. - repeated string args = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of files to be placed in the working directory of - // each executor. Useful for naively parallel tasks. - repeated string file_uris = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. HCFS URIs of archives to be extracted into the working directory - // of each executor. Supported file types: - // .jar, .tar, .tar.gz, .tgz, and .zip. - repeated string archive_uris = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, used to configure SparkR. - // Properties that conflict with values set by the Dataproc API may be - // overwritten. Can include properties set in - // /etc/spark/conf/spark-defaults.conf and classes in user code. - map properties = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running [Presto](https://prestosql.io/) queries. -// **IMPORTANT**: The [Dataproc Presto Optional -// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto) -// must be enabled when the cluster is created to submit a Presto job to the -// cluster. -message PrestoJob { - // Required. The sequence of Presto queries to execute, specified as - // either an HCFS file URI or as a list of queries. - oneof queries { - // The HCFS URI of the script that contains SQL queries. - string query_file_uri = 1; - - // A list of queries. - QueryList query_list = 2; - } - - // Optional. Whether to continue executing queries if a query fails. - // The default value is `false`. Setting to `true` can be useful when - // executing independent parallel queries. - bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The format in which query output will be displayed. See the - // Presto documentation for supported output formats - string output_format = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Presto client tags to attach to this query - repeated string client_tags = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values. Used to set Presto - // [session properties](https://prestodb.io/docs/current/sql/set-session.html) - // Equivalent to using the --session flag in the Presto CLI - map properties = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job for running [Trino](https://trino.io/) queries. -// **IMPORTANT**: The [Dataproc Trino Optional -// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino) -// must be enabled when the cluster is created to submit a Trino job to the -// cluster. -message TrinoJob { - // Required. The sequence of Trino queries to execute, specified as - // either an HCFS file URI or as a list of queries. - oneof queries { - // The HCFS URI of the script that contains SQL queries. - string query_file_uri = 1; - - // A list of queries. - QueryList query_list = 2; - } - - // Optional. Whether to continue executing queries if a query fails. - // The default value is `false`. Setting to `true` can be useful when - // executing independent parallel queries. - bool continue_on_failure = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The format in which query output will be displayed. See the - // Trino documentation for supported output formats - string output_format = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Trino client tags to attach to this query - repeated string client_tags = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values. Used to set Trino - // [session properties](https://trino.io/docs/current/sql/set-session.html) - // Equivalent to using the --session flag in the Trino CLI - map properties = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The runtime log config for job execution. - LoggingConfig logging_config = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Dataproc job config. -message JobPlacement { - // Required. The name of the cluster where the job will be submitted. - string cluster_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. A cluster UUID generated by the Dataproc service when - // the job is submitted. - string cluster_uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Cluster labels to identify a cluster where the job will be - // submitted. - map cluster_labels = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Dataproc job status. -message JobStatus { - // The job state. - enum State { - // The job state is unknown. - STATE_UNSPECIFIED = 0; - - // The job is pending; it has been submitted, but is not yet running. - PENDING = 1; - - // Job has been received by the service and completed initial setup; - // it will soon be submitted to the cluster. - SETUP_DONE = 8; - - // The job is running on the cluster. - RUNNING = 2; - - // A CancelJob request has been received, but is pending. - CANCEL_PENDING = 3; - - // Transient in-flight resources have been canceled, and the request to - // cancel the running job has been issued to the cluster. - CANCEL_STARTED = 7; - - // The job cancellation was successful. - CANCELLED = 4; - - // The job has completed successfully. - DONE = 5; - - // The job has completed, but encountered an error. - ERROR = 6; - - // Job attempt has failed. The detail field contains failure details for - // this attempt. - // - // Applies to restartable jobs only. - ATTEMPT_FAILURE = 9; - } - - // The job substate. - enum Substate { - // The job substate is unknown. - UNSPECIFIED = 0; - - // The Job is submitted to the agent. - // - // Applies to RUNNING state. - SUBMITTED = 1; - - // The Job has been received and is awaiting execution (it may be waiting - // for a condition to be met). See the "details" field for the reason for - // the delay. - // - // Applies to RUNNING state. - QUEUED = 2; - - // The agent-reported status is out of date, which may be caused by a - // loss of communication between the agent and Dataproc. If the - // agent does not send a timely update, the job will fail. - // - // Applies to RUNNING state. - STALE_STATUS = 3; - } - - // Output only. A state message specifying the overall job state. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. Job state details, such as an error - // description if the state is ERROR. - string details = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Output only. The time when this state was entered. - google.protobuf.Timestamp state_start_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional state information, which includes - // status reported by the agent. - Substate substate = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Encapsulates the full scoping used to reference a job. -message JobReference { - // Optional. The ID of the Google Cloud Platform project that the job belongs - // to. If specified, must match the request project ID. - string project_id = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The job ID, which must be unique within the project. - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), or hyphens (-). The maximum length is 100 characters. - // - // If not specified by the caller, the job ID will be provided by the server. - string job_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A YARN application created by a job. Application information is a subset of -// org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto. -// -// **Beta Feature**: This report is available for testing purposes only. It may -// be changed before final release. -message YarnApplication { - // The application state, corresponding to - // YarnProtos.YarnApplicationStateProto. - enum State { - // Status is unspecified. - STATE_UNSPECIFIED = 0; - - // Status is NEW. - NEW = 1; - - // Status is NEW_SAVING. - NEW_SAVING = 2; - - // Status is SUBMITTED. - SUBMITTED = 3; - - // Status is ACCEPTED. - ACCEPTED = 4; - - // Status is RUNNING. - RUNNING = 5; - - // Status is FINISHED. - FINISHED = 6; - - // Status is FAILED. - FAILED = 7; - - // Status is KILLED. - KILLED = 8; - } - - // Required. The application name. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The application state. - State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The numerical progress of the application, from 1 to 100. - float progress = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or - // TimelineServer that provides application-specific information. The URL uses - // the internal hostname, and requires a proxy server for resolution and, - // possibly, access. - string tracking_url = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A Dataproc job resource. -message Job { - // Optional. The fully qualified reference to the job, which can be used to - // obtain the equivalent REST path of the job resource. If this property - // is not specified when a job is created, the server generates a - // job_id. - JobReference reference = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Job information, including how, when, and where to - // run the job. - JobPlacement placement = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The application/framework-specific portion of the job. - oneof type_job { - // Optional. Job is a Hadoop job. - HadoopJob hadoop_job = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Spark job. - SparkJob spark_job = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a PySpark job. - PySparkJob pyspark_job = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Hive job. - HiveJob hive_job = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Pig job. - PigJob pig_job = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a SparkR job. - SparkRJob spark_r_job = 21 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a SparkSql job. - SparkSqlJob spark_sql_job = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Presto job. - PrestoJob presto_job = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Trino job. - TrinoJob trino_job = 28 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The job status. Additional application-specific - // status information may be contained in the type_job - // and yarn_applications fields. - JobStatus status = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The previous job status. - repeated JobStatus status_history = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The collection of YARN applications spun up by this job. - // - // **Beta** Feature: This report is available for testing purposes only. It - // may be changed before final release. - repeated YarnApplication yarn_applications = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URI pointing to the location of the stdout of the job's - // driver program. - string driver_output_resource_uri = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If present, the location of miscellaneous control files - // which may be used as part of job setup and handling. If not present, - // control files may be placed in the same location as `driver_output_uri`. - string driver_control_files_uri = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The labels to associate with this job. - // Label **keys** must contain 1 to 63 characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // Label **values** may be empty, but, if present, must contain 1 to 63 - // characters, and must conform to [RFC - // 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be - // associated with a job. - map labels = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job scheduling configuration. - JobScheduling scheduling = 20 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. A UUID that uniquely identifies a job within the project - // over time. This is in contrast to a user-settable reference.job_id that - // may be reused over time. - string job_uuid = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether the job is completed. If the value is - // `false`, the job is still in progress. If `true`, the job is completed, and - // `status.state` field will indicate if it was successful, failed, - // or cancelled. - bool done = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Driver scheduling configuration. - DriverSchedulingConfig driver_scheduling_config = 27 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Driver scheduling configuration. -message DriverSchedulingConfig { - // Required. The amount of memory in MB the driver is requesting. - int32 memory_mb = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The number of vCPUs the driver is requesting. - int32 vcores = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Job scheduling options. -message JobScheduling { - // Optional. Maximum number of times per hour a driver may be restarted as - // a result of driver exiting with non-zero code before job is - // reported failed. - // - // A job may be reported as thrashing if the driver exits with a non-zero code - // four times within a 10-minute window. - // - // Maximum value is 10. - // - // **Note:** This restartable job option is not supported in Dataproc - // [workflow templates] - // (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). - int32 max_failures_per_hour = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Maximum total number of times a driver may be restarted as a - // result of the driver exiting with a non-zero code. After the maximum number - // is reached, the job will be reported as failed. - // - // Maximum value is 240. - // - // **Note:** Currently, this restartable job option is - // not supported in Dataproc - // [workflow - // templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template). - int32 max_failures_total = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to submit a job. -message SubmitJobRequest { - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job resource. - Job job = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique id used to identify the request. If the server - // receives two - // [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s - // with the same id, then the second request will be ignored and the - // first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend - // is returned. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The id must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Job Operation metadata. -message JobMetadata { - // Output only. The job id. - string job_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Most recent job status. - JobStatus status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Operation type. - string operation_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Job submission time. - google.protobuf.Timestamp start_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request to get the resource representation for a job in a project. -message GetJobRequest { - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job ID. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to list jobs in a project. -message ListJobsRequest { - // A matcher that specifies categories of job states. - enum JobStateMatcher { - // Match all jobs, regardless of state. - ALL = 0; - - // Only match jobs in non-terminal states: PENDING, RUNNING, or - // CANCEL_PENDING. - ACTIVE = 1; - - // Only match jobs in terminal states: CANCELLED, DONE, or ERROR. - NON_ACTIVE = 2; - } - - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The number of results to return in each response. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The page token, returned by a previous call, to request the - // next page of results. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, the returned jobs list includes only jobs that were - // submitted to the named cluster. - string cluster_name = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies enumerated categories of jobs to list. - // (default = match ALL jobs). - // - // If `filter` is provided, `jobStateMatcher` will be ignored. - JobStateMatcher job_state_matcher = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter constraining the jobs to list. Filters are - // case-sensitive and have the following syntax: - // - // [field = value] AND [field [= value]] ... - // - // where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label - // key. **value** can be `*` to match all values. - // `status.state` can be either `ACTIVE` or `NON_ACTIVE`. - // Only the logical `AND` operator is supported; space-separated items are - // treated as having an implicit `AND` operator. - // - // Example filter: - // - // status.state = ACTIVE AND labels.env = staging AND labels.starred = * - string filter = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a job. -message UpdateJobRequest { - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job ID. - string job_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The changes to the job. - Job job = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specifies the path, relative to Job, of - // the field to update. For example, to update the labels of a Job the - // update_mask parameter would be specified as - // labels, and the `PATCH` request body would specify the new - // value. Note: Currently, labels is the only - // field that can be updated. - google.protobuf.FieldMask update_mask = 5 - [(google.api.field_behavior) = REQUIRED]; -} - -// A list of jobs in a project. -message ListJobsResponse { - // Output only. Jobs list. - repeated Job jobs = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This token is included in the response if there are more results - // to fetch. To fetch additional results, provide this value as the - // `page_token` in a subsequent ListJobsRequest. - string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to cancel a job. -message CancelJobRequest { - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job ID. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to delete a job. -message DeleteJobRequest { - // Required. The ID of the Google Cloud Platform project that the job - // belongs to. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Dataproc region in which to handle the request. - string region = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job ID. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto deleted file mode 100644 index 5a0509728082..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/node_groups.proto +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dataproc/v1/clusters.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "NodeGroupsProto"; -option java_package = "com.google.cloud.dataproc.v1"; -option (google.api.resource_definition) = { - type: "dataproc.googleapis.com/ClusterRegion" - pattern: "projects/{project}/regions/{region}/clusters/{cluster}" -}; - -// The `NodeGroupControllerService` provides methods to manage node groups -// of Compute Engine managed instances. -service NodeGroupController { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a node group in a cluster. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] is - // [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). - rpc CreateNodeGroup(CreateNodeGroupRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/regions/*/clusters/*}/nodeGroups" - body: "node_group" - }; - option (google.api.method_signature) = "parent,node_group,node_group_id"; - option (google.longrunning.operation_info) = { - response_type: "NodeGroup" - metadata_type: "google.cloud.dataproc.v1.NodeGroupOperationMetadata" - }; - } - - // Resizes a node group in a cluster. The returned - // [Operation.metadata][google.longrunning.Operation.metadata] is - // [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). - rpc ResizeNodeGroup(ResizeNodeGroupRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}:resize" - body: "*" - }; - option (google.api.method_signature) = "name,size"; - option (google.longrunning.operation_info) = { - response_type: "NodeGroup" - metadata_type: "google.cloud.dataproc.v1.NodeGroupOperationMetadata" - }; - } - - // Gets the resource representation for a node group in a - // cluster. - rpc GetNodeGroup(GetNodeGroupRequest) returns (NodeGroup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/regions/*/clusters/*/nodeGroups/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// A request to create a node group. -message CreateNodeGroupRequest { - // Required. The parent resource where this node group will be created. - // Format: `projects/{project}/regions/{region}/clusters/{cluster}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/NodeGroup" - } - ]; - - // Required. The node group to create. - NodeGroup node_group = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional node group ID. Generated if not specified. - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). Cannot begin or end with underscore - // or hyphen. Must consist of from 3 to 33 characters. - string node_group_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique ID used to identify the request. If the server receives - // two - // [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) - // with the same ID, the second request is ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // Recommendation: Set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to resize a node group. -message ResizeNodeGroupRequest { - // Required. The name of the node group to resize. - // Format: - // `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The number of running instances for the node group to maintain. - // The group adds or removes instances to maintain the number of instances - // specified by this parameter. - int32 size = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique ID used to identify the request. If the server receives - // two - // [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) - // with the same ID, the second request is ignored and the - // first [google.longrunning.Operation][google.longrunning.Operation] created - // and stored in the backend is returned. - // - // Recommendation: Set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The ID must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Timeout for graceful YARN decommissioning. [Graceful - // decommissioning] - // (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) - // allows the removal of nodes from the Compute Engine node group - // without interrupting jobs in progress. This timeout specifies how long to - // wait for jobs in progress to finish before forcefully removing nodes (and - // potentially interrupting jobs). Default timeout is 0 (for forceful - // decommission), and the maximum allowed timeout is 1 day. (see JSON - // representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // - // Only supported on Dataproc image versions 1.2 and higher. - google.protobuf.Duration graceful_decommission_timeout = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to get a node group . -message GetNodeGroupRequest { - // Required. The name of the node group to retrieve. - // Format: - // `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/NodeGroup" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto deleted file mode 100644 index d9fad26d2128..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/operations.proto +++ /dev/null @@ -1,170 +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.dataproc.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "OperationsProto"; -option java_package = "com.google.cloud.dataproc.v1"; - -// Metadata describing the Batch operation. -message BatchOperationMetadata { - // Operation type for Batch resources - enum BatchOperationType { - // Batch operation type is unknown. - BATCH_OPERATION_TYPE_UNSPECIFIED = 0; - - // Batch operation type. - BATCH = 1; - } - - // Name of the batch for the operation. - string batch = 1; - - // Batch UUID for the operation. - string batch_uuid = 2; - - // The time when the operation was created. - google.protobuf.Timestamp create_time = 3; - - // The time when the operation finished. - google.protobuf.Timestamp done_time = 4; - - // The operation type. - BatchOperationType operation_type = 6; - - // Short description of the operation. - string description = 7; - - // Labels associated with the operation. - map labels = 8; - - // Warnings encountered during operation execution. - repeated string warnings = 9; -} - -// The status of the operation. -message ClusterOperationStatus { - // The operation state. - enum State { - // Unused. - UNKNOWN = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is running. - RUNNING = 2; - - // The operation is done; either cancelled or completed. - DONE = 3; - } - - // Output only. A message containing the operation state. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A message containing the detailed operation state. - string inner_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A message containing any operation metadata details. - string details = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this state was entered. - google.protobuf.Timestamp state_start_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata describing the operation. -message ClusterOperationMetadata { - // Output only. Name of the cluster for the operation. - string cluster_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Cluster UUID for the operation. - string cluster_uuid = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current operation status. - ClusterOperationStatus status = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The previous operation status. - repeated ClusterOperationStatus status_history = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The operation type. - string operation_type = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Short description of operation. - string description = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Labels associated with the operation - map labels = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Errors encountered during operation execution. - repeated string warnings = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Child operation ids - repeated string child_operation_ids = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata describing the node group operation. -message NodeGroupOperationMetadata { - // Operation type for node group resources. - enum NodeGroupOperationType { - // Node group operation type is unknown. - NODE_GROUP_OPERATION_TYPE_UNSPECIFIED = 0; - - // Create node group operation type. - CREATE = 1; - - // Update node group operation type. - UPDATE = 2; - - // Delete node group operation type. - DELETE = 3; - - // Resize node group operation type. - RESIZE = 4; - } - - // Output only. Node group ID for the operation. - string node_group_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Cluster UUID associated with the node group operation. - string cluster_uuid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Current operation status. - ClusterOperationStatus status = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The previous operation status. - repeated ClusterOperationStatus status_history = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The operation type. - NodeGroupOperationType operation_type = 5; - - // Output only. Short description of operation. - string description = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Labels associated with the operation. - map labels = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Errors encountered during operation execution. - repeated string warnings = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto deleted file mode 100644 index e3f1091e1802..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/shared.proto +++ /dev/null @@ -1,476 +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.dataproc.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "SharedProto"; -option java_package = "com.google.cloud.dataproc.v1"; -option (google.api.resource_definition) = { - type: "container.googleapis.com/Cluster" - pattern: "projects/{project}/locations/{location}/clusters/{cluster}" -}; -option (google.api.resource_definition) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" -}; - -// Runtime configuration for a workload. -message RuntimeConfig { - // Optional. Version of the batch runtime. - string version = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional custom container image for the job runtime environment. - // If not specified, a default container image will be used. - string container_image = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A mapping of property names to values, which are used to - // configure workload execution. - map properties = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Environment configuration for a workload. -message EnvironmentConfig { - // Optional. Execution configuration for a workload. - ExecutionConfig execution_config = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Peripherals configuration that workload has access to. - PeripheralsConfig peripherals_config = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Execution configuration for a workload. -message ExecutionConfig { - // Optional. Service account that used to execute workload. - string service_account = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Network configuration for workload execution. - oneof network { - // Optional. Network URI to connect workload to. - string network_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Subnetwork URI to connect workload to. - string subnetwork_uri = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Tags used for network traffic control. - repeated string network_tags = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Cloud KMS key to use for encryption. - string kms_key = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The duration after which the workload will be terminated. - // When the workload passes this ttl, it will be unconditionally killed - // without waiting for ongoing work to finish. - // Minimum value is 10 minutes; maximum value is 14 days (see JSON - // representation of - // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // If both ttl and idle_ttl are specified, the conditions are treated as - // and OR: the workload will be terminated when it has been idle for idle_ttl - // or when the ttl has passed, whichever comes first. - // If ttl is not specified for a session, it defaults to 24h. - google.protobuf.Duration ttl = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A Cloud Storage bucket used to stage workload dependencies, - // config files, and store workload output and other ephemeral data, such as - // Spark history files. If you do not specify a staging bucket, Cloud Dataproc - // will determine a Cloud Storage location according to the region where your - // workload is running, and then create and manage project-level, per-location - // staging and temporary buckets. - // **This field requires a Cloud Storage bucket name, not a `gs://...` URI to - // a Cloud Storage bucket.** - string staging_bucket = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -// Spark History Server configuration for the workload. -message SparkHistoryServerConfig { - // Optional. Resource name of an existing Dataproc Cluster to act as a Spark - // History Server for the workload. - // - // Example: - // - // * `projects/[project_id]/regions/[region]/clusters/[cluster_name]` - string dataproc_cluster = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Auxiliary services configuration for a workload. -message PeripheralsConfig { - // Optional. Resource name of an existing Dataproc Metastore service. - // - // Example: - // - // * `projects/[project_id]/locations/[region]/services/[service_id]` - string metastore_service = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The Spark History Server configuration for the workload. - SparkHistoryServerConfig spark_history_server_config = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Runtime information about workload execution. -message RuntimeInfo { - // Output only. Map of remote access endpoints (such as web interfaces and - // APIs) to their URIs. - map endpoints = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URI pointing to the location of the stdout and stderr of the - // workload. - string output_uri = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URI pointing to the location of the diagnostics tarball. - string diagnostic_output_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Approximate workload resource usage calculated after workload - // finishes (see [Dataproc Serverless pricing] - // (https://cloud.google.com/dataproc-serverless/pricing)). - UsageMetrics approximate_usage = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Snapshot of current workload resource usage. - UsageSnapshot current_usage = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Usage metrics represent approximate total resources consumed by a workload. -message UsageMetrics { - // Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`) - // (see [Dataproc Serverless pricing] - // (https://cloud.google.com/dataproc-serverless/pricing)). - int64 milli_dcu_seconds = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Shuffle storage usage in (`GB` x `seconds`) (see - // [Dataproc Serverless pricing] - // (https://cloud.google.com/dataproc-serverless/pricing)). - int64 shuffle_storage_gb_seconds = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The usage snaphot represents the resources consumed by a workload at a -// specified time. -message UsageSnapshot { - // Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see - // [Dataproc Serverless pricing] - // (https://cloud.google.com/dataproc-serverless/pricing)). - int64 milli_dcu = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless - // pricing] (https://cloud.google.com/dataproc-serverless/pricing)) - int64 shuffle_storage_gb = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The timestamp of the usage snapshot. - google.protobuf.Timestamp snapshot_time = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The cluster's GKE config. -message GkeClusterConfig { - // Optional. A target GKE cluster to deploy to. It must be in the same project - // and region as the Dataproc cluster (the GKE cluster can be zonal or - // regional). Format: - // 'projects/{project}/locations/{location}/clusters/{cluster_id}' - string gke_cluster_target = 2 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "container.googleapis.com/Cluster" - } - ]; - - // Optional. GKE node pools where workloads will be scheduled. At least one - // node pool must be assigned the `DEFAULT` - // [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role]. - // If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT` - // `GkeNodePoolTarget`. Each role can be given to only one - // `GkeNodePoolTarget`. All node pools must have the same location settings. - repeated GkeNodePoolTarget node_pool_target = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The configuration for running the Dataproc cluster on Kubernetes. -message KubernetesClusterConfig { - // Optional. A namespace within the Kubernetes cluster to deploy into. If this - // namespace does not exist, it is created. If it exists, Dataproc verifies - // that another Dataproc VirtualCluster is not installed into it. If not - // specified, the name of the Dataproc Cluster is used. - string kubernetes_namespace = 1 [(google.api.field_behavior) = OPTIONAL]; - - oneof config { - // Required. The configuration for running the Dataproc cluster on GKE. - GkeClusterConfig gke_cluster_config = 2 - [(google.api.field_behavior) = REQUIRED]; - } - - // Optional. The software configuration for this Dataproc cluster running on - // Kubernetes. - KubernetesSoftwareConfig kubernetes_software_config = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The software configuration for this Dataproc cluster running on Kubernetes. -message KubernetesSoftwareConfig { - // The components that should be installed in this Dataproc cluster. The key - // must be a string from the KubernetesComponent enumeration. The value is - // the version of the software to be installed. - // At least one entry must be specified. - map component_version = 1; - - // The properties to set on daemon config files. - // - // Property keys are specified in `prefix:property` format, for example - // `spark:spark.kubernetes.container.image`. The following are supported - // prefixes and their mappings: - // - // * spark: `spark-defaults.conf` - // - // For more information, see [Cluster - // properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties). - map properties = 2; -} - -// GKE node pools that Dataproc workloads run on. -message GkeNodePoolTarget { - // `Role` specifies the tasks that will run on the node pool. Roles can be - // specific to workloads. Exactly one - // [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the - // virtual cluster must have the `DEFAULT` role, which is used to run all - // workloads that are not associated with a node pool. - enum Role { - // Role is unspecified. - ROLE_UNSPECIFIED = 0; - - // At least one node pool must have the `DEFAULT` role. - // Work assigned to a role that is not associated with a node pool - // is assigned to the node pool with the `DEFAULT` role. For example, - // work assigned to the `CONTROLLER` role will be assigned to the node pool - // with the `DEFAULT` role if no node pool has the `CONTROLLER` role. - DEFAULT = 1; - - // Run work associated with the Dataproc control plane (for example, - // controllers and webhooks). Very low resource requirements. - CONTROLLER = 2; - - // Run work associated with a Spark driver of a job. - SPARK_DRIVER = 3; - - // Run work associated with a Spark executor of a job. - SPARK_EXECUTOR = 4; - } - - // Required. The target GKE node pool. - // Format: - // 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}' - string node_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The roles associated with the GKE node pool. - repeated Role roles = 2 [(google.api.field_behavior) = REQUIRED]; - - // Input only. The configuration for the GKE node pool. - // - // If specified, Dataproc attempts to create a node pool with the - // specified shape. If one with the same name already exists, it is - // verified against all specified fields. If a field differs, the - // virtual cluster creation will fail. - // - // If omitted, any node pool with the specified name is used. If a - // node pool with the specified name does not exist, Dataproc create a - // node pool with default values. - // - // This is an input only field. It will not be returned by the API. - GkeNodePoolConfig node_pool_config = 3 - [(google.api.field_behavior) = INPUT_ONLY]; -} - -// The configuration of a GKE node pool used by a [Dataproc-on-GKE -// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster). -message GkeNodePoolConfig { - // Parameters that describe cluster nodes. - message GkeNodeConfig { - // Optional. The name of a Compute Engine [machine - // type](https://cloud.google.com/compute/docs/machine-types). - string machine_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of local SSD disks to attach to the node, which is - // limited by the maximum number of disks allowable per zone (see [Adding - // Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)). - int32 local_ssd_count = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether the nodes are created as legacy [preemptible VM - // instances] (https://cloud.google.com/compute/docs/instances/preemptible). - // Also see - // [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot] - // VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot - // preemptible nodes cannot be used in a node pool with the `CONTROLLER` - // [role] - // (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role) - // or in the DEFAULT node pool if the CONTROLLER role is not assigned (the - // DEFAULT node pool will assume the CONTROLLER role). - bool preemptible = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A list of [hardware - // accelerators](https://cloud.google.com/compute/docs/gpus) to attach to - // each node. - repeated GkeNodePoolAcceleratorConfig accelerators = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. [Minimum CPU - // platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) - // to be used by this instance. The instance may be scheduled on the - // specified or a newer CPU platform. Specify the friendly names of CPU - // platforms, such as "Intel Haswell"` or Intel Sandy Bridge". - string min_cpu_platform = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [Customer Managed Encryption Key (CMEK)] - // (https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek) - // used to encrypt the boot disk attached to each node in the node pool. - // Specify the key using the following format: - // projects/KEY_PROJECT_ID/locations/LOCATION/keyRings/RING_NAME/cryptoKeys/KEY_NAME. - string boot_disk_kms_key = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether the nodes are created as [Spot VM instances] - // (https://cloud.google.com/compute/docs/instances/spot). - // Spot VMs are the latest update to legacy - // [preemptible - // VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]. - // Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible - // nodes cannot be used in a node pool with the `CONTROLLER` - // [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role) - // or in the DEFAULT node pool if the CONTROLLER role is not assigned (the - // DEFAULT node pool will assume the CONTROLLER role). - bool spot = 32 [(google.api.field_behavior) = OPTIONAL]; - } - - // A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request - // for a node pool. - message GkeNodePoolAcceleratorConfig { - // The number of accelerator cards exposed to an instance. - int64 accelerator_count = 1; - - // The accelerator type resource namename (see GPUs on Compute Engine). - string accelerator_type = 2; - - // Size of partitions to create on the GPU. Valid values are described in - // the NVIDIA [mig user - // guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning). - string gpu_partition_size = 3; - } - - // GkeNodePoolAutoscaling contains information the cluster autoscaler needs to - // adjust the size of the node pool to the current cluster usage. - message GkeNodePoolAutoscalingConfig { - // The minimum number of nodes in the node pool. Must be >= 0 and <= - // max_node_count. - int32 min_node_count = 2; - - // The maximum number of nodes in the node pool. Must be >= min_node_count, - // and must be > 0. - // **Note:** Quota must be sufficient to scale up the cluster. - int32 max_node_count = 3; - } - - // Optional. The node pool configuration. - GkeNodeConfig config = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of Compute Engine - // [zones](https://cloud.google.com/compute/docs/zones#available) where - // node pool nodes associated with a Dataproc on GKE virtual cluster - // will be located. - // - // **Note:** All node pools associated with a virtual cluster - // must be located in the same region as the virtual cluster, and they must - // be located in the same zone within that region. - // - // If a location is not specified during node pool creation, Dataproc on GKE - // will choose the zone. - repeated string locations = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The autoscaler configuration for this node pool. The autoscaler - // is enabled only when a valid configuration is present. - GkeNodePoolAutoscalingConfig autoscaling = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Cluster components that can be activated. -enum Component { - // Unspecified component. Specifying this will cause Cluster creation to fail. - COMPONENT_UNSPECIFIED = 0; - - // The Anaconda python distribution. The Anaconda component is not supported - // in the Dataproc - // 2.0 - // image. The 2.0 image is pre-installed with Miniconda. - ANACONDA = 5; - - // Docker - DOCKER = 13; - - // The Druid query engine. (alpha) - DRUID = 9; - - // Flink - FLINK = 14; - - // HBase. (beta) - HBASE = 11; - - // The Hive Web HCatalog (the REST service for accessing HCatalog). - HIVE_WEBHCAT = 3; - - // Hudi. - HUDI = 18; - - // The Jupyter Notebook. - JUPYTER = 1; - - // The Presto query engine. - PRESTO = 6; - - // The Trino query engine. - TRINO = 17; - - // The Ranger service. - RANGER = 12; - - // The Solr service. - SOLR = 10; - - // The Zeppelin notebook. - ZEPPELIN = 4; - - // The Zookeeper service. - ZOOKEEPER = 8; -} - -// Actions in response to failure of a resource associated with a cluster. -enum FailureAction { - // When FailureAction is unspecified, failure action defaults to NO_ACTION. - FAILURE_ACTION_UNSPECIFIED = 0; - - // Take no action on failure to create a cluster resource. NO_ACTION is the - // default. - NO_ACTION = 1; - - // Delete the failed cluster resource. - DELETE = 2; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto b/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto deleted file mode 100644 index bb6a639a095e..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/protos/google/cloud/dataproc/v1/workflow_templates.proto +++ /dev/null @@ -1,836 +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.dataproc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/dataproc/v1/clusters.proto"; -import "google/cloud/dataproc/v1/jobs.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; -option java_multiple_files = true; -option java_outer_classname = "WorkflowTemplatesProto"; -option java_package = "com.google.cloud.dataproc.v1"; - -// The API interface for managing Workflow Templates in the -// Dataproc API. -service WorkflowTemplateService { - option (google.api.default_host) = "dataproc.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates new workflow template. - rpc CreateWorkflowTemplate(CreateWorkflowTemplateRequest) - returns (WorkflowTemplate) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workflowTemplates" - body: "template" - additional_bindings { - post: "/v1/{parent=projects/*/regions/*}/workflowTemplates" - body: "template" - } - }; - option (google.api.method_signature) = "parent,template"; - } - - // Retrieves the latest workflow template. - // - // Can retrieve previously instantiated template by specifying optional - // version parameter. - rpc GetWorkflowTemplate(GetWorkflowTemplateRequest) - returns (WorkflowTemplate) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workflowTemplates/*}" - additional_bindings { - get: "/v1/{name=projects/*/regions/*/workflowTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Instantiates a template and begins execution. - // - // The returned Operation can be used to track execution of - // workflow by polling - // [operations.get][google.longrunning.Operations.GetOperation]. - // The Operation will complete when entire workflow is finished. - // - // The running workflow can be aborted via - // [operations.cancel][google.longrunning.Operations.CancelOperation]. - // This will cause any inflight jobs to be cancelled and workflow-owned - // clusters to be deleted. - // - // The [Operation.metadata][google.longrunning.Operation.metadata] will be - // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). - // Also see [Using - // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). - // - // On successful completion, - // [Operation.response][google.longrunning.Operation.response] will be - // [Empty][google.protobuf.Empty]. - rpc InstantiateWorkflowTemplate(InstantiateWorkflowTemplateRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/workflowTemplates/*}:instantiate" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/regions/*/workflowTemplates/*}:instantiate" - body: "*" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,parameters"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "WorkflowMetadata" - }; - } - - // Instantiates a template and begins execution. - // - // This method is equivalent to executing the sequence - // [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], - // [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], - // [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. - // - // The returned Operation can be used to track execution of - // workflow by polling - // [operations.get][google.longrunning.Operations.GetOperation]. - // The Operation will complete when entire workflow is finished. - // - // The running workflow can be aborted via - // [operations.cancel][google.longrunning.Operations.CancelOperation]. - // This will cause any inflight jobs to be cancelled and workflow-owned - // clusters to be deleted. - // - // The [Operation.metadata][google.longrunning.Operation.metadata] will be - // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). - // Also see [Using - // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). - // - // On successful completion, - // [Operation.response][google.longrunning.Operation.response] will be - // [Empty][google.protobuf.Empty]. - rpc InstantiateInlineWorkflowTemplate( - InstantiateInlineWorkflowTemplateRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workflowTemplates:instantiateInline" - body: "template" - additional_bindings { - post: "/v1/{parent=projects/*/regions/*}/workflowTemplates:instantiateInline" - body: "template" - } - }; - option (google.api.method_signature) = "parent,template"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "WorkflowMetadata" - }; - } - - // Updates (replaces) workflow template. The updated template - // must contain version that matches the current server version. - rpc UpdateWorkflowTemplate(UpdateWorkflowTemplateRequest) - returns (WorkflowTemplate) { - option (google.api.http) = { - put: "/v1/{template.name=projects/*/locations/*/workflowTemplates/*}" - body: "template" - additional_bindings { - put: "/v1/{template.name=projects/*/regions/*/workflowTemplates/*}" - body: "template" - } - }; - option (google.api.method_signature) = "template"; - } - - // Lists workflows that match the specified filter in the request. - rpc ListWorkflowTemplates(ListWorkflowTemplatesRequest) - returns (ListWorkflowTemplatesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workflowTemplates" - additional_bindings { - get: "/v1/{parent=projects/*/regions/*}/workflowTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a workflow template. It does not cancel in-progress workflows. - rpc DeleteWorkflowTemplate(DeleteWorkflowTemplateRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workflowTemplates/*}" - additional_bindings { - delete: "/v1/{name=projects/*/regions/*/workflowTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// A Dataproc workflow template resource. -message WorkflowTemplate { - option (google.api.resource) = { - type: "dataproc.googleapis.com/WorkflowTemplate" - pattern: "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}" - pattern: "projects/{project}/locations/{location}/workflowTemplates/{workflow_template}" - history: ORIGINALLY_SINGLE_PATTERN - }; - - string id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The resource name of the workflow template, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates`, the resource name of the - // template has the following format: - // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - // - // * For `projects.locations.workflowTemplates`, the resource name of the - // template has the following format: - // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Used to perform a consistent read-modify-write. - // - // This field should be left blank for a `CreateWorkflowTemplate` request. It - // is required for an `UpdateWorkflowTemplate` request, and must match the - // current server version. A typical update template flow would fetch the - // current template with a `GetWorkflowTemplate` request, which will return - // the current template with the `version` field filled in with the - // current server version. The user updates other fields in the template, - // then returns it as part of the `UpdateWorkflowTemplate` request. - int32 version = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time template was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time template was last updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The labels to associate with this template. These labels - // will be propagated to all jobs and clusters created by the workflow - // instance. - // - // Label **keys** must contain 1 to 63 characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // - // Label **values** may be empty, but, if present, must contain 1 to 63 - // characters, and must conform to - // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). - // - // No more than 32 labels can be associated with a template. - map labels = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Required. WorkflowTemplate scheduling information. - WorkflowTemplatePlacement placement = 7 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The Directed Acyclic Graph of Jobs to submit. - repeated OrderedJob jobs = 8 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Template parameters whose values are substituted into the - // template. Values for parameters must be provided when the template is - // instantiated. - repeated TemplateParameter parameters = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Timeout duration for the DAG of jobs, expressed in seconds (see - // [JSON representation of - // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - // The timeout duration must be from 10 minutes ("600s") to 24 hours - // ("86400s"). The timer begins when the first job is submitted. If the - // workflow is running at the end of the timeout period, any remaining jobs - // are cancelled, the workflow is ended, and if the workflow was running on a - // [managed - // cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster), - // the cluster is deleted. - google.protobuf.Duration dag_timeout = 10 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Specifies workflow execution target. -// -// Either `managed_cluster` or `cluster_selector` is required. -message WorkflowTemplatePlacement { - // Required. Specifies where workflow executes; either on a managed - // cluster or an existing cluster chosen by labels. - oneof placement { - // A cluster that is managed by the workflow. - ManagedCluster managed_cluster = 1; - - // Optional. A selector that chooses target cluster for jobs based - // on metadata. - // - // The selector is evaluated at the time each job is submitted. - ClusterSelector cluster_selector = 2; - } -} - -// Cluster that is managed by the workflow. -message ManagedCluster { - // Required. The cluster name prefix. A unique cluster name will be formed by - // appending a random suffix. - // - // The name must contain only lower-case letters (a-z), numbers (0-9), - // and hyphens (-). Must begin with a letter. Cannot begin or end with - // hyphen. Must consist of between 2 and 35 characters. - string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster configuration. - ClusterConfig config = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The labels to associate with this cluster. - // - // Label keys must be between 1 and 63 characters long, and must conform to - // the following PCRE regular expression: - // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} - // - // Label values must be between 1 and 63 characters long, and must conform to - // the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} - // - // No more than 32 labels can be associated with a given cluster. - map labels = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A selector that chooses target cluster for jobs based on metadata. -message ClusterSelector { - // Optional. The zone where workflow process executes. This parameter does not - // affect the selection of the cluster. - // - // If unspecified, the zone of the first cluster matching the selector - // is used. - string zone = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The cluster labels. Cluster must have all labels - // to match. - map cluster_labels = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// A job executed by the workflow. -message OrderedJob { - // Required. The step id. The id must be unique among all jobs - // within the template. - // - // The step id is used as prefix for job id, as job - // `goog-dataproc-workflow-step-id` label, and in - // [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids] - // field from other steps. - // - // The id must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). Cannot begin or end with underscore - // or hyphen. Must consist of between 3 and 50 characters. - string step_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The job definition. - oneof job_type { - // Optional. Job is a Hadoop job. - HadoopJob hadoop_job = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Spark job. - SparkJob spark_job = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a PySpark job. - PySparkJob pyspark_job = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Hive job. - HiveJob hive_job = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Pig job. - PigJob pig_job = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a SparkR job. - SparkRJob spark_r_job = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a SparkSql job. - SparkSqlJob spark_sql_job = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job is a Presto job. - PrestoJob presto_job = 12 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The labels to associate with this job. - // - // Label keys must be between 1 and 63 characters long, and must conform to - // the following regular expression: - // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} - // - // Label values must be between 1 and 63 characters long, and must conform to - // the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} - // - // No more than 32 labels can be associated with a given job. - map labels = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job scheduling configuration. - JobScheduling scheduling = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The optional list of prerequisite job step_ids. - // If not specified, the job will start at the beginning of workflow. - repeated string prerequisite_step_ids = 10 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A configurable parameter that replaces one or more fields in the template. -// Parameterizable fields: -// - Labels -// - File uris -// - Job properties -// - Job arguments -// - Script variables -// - Main class (in HadoopJob and SparkJob) -// - Zone (in ClusterSelector) -message TemplateParameter { - // Required. Parameter name. - // The parameter name is used as the key, and paired with the - // parameter value, which are passed to the template when the template - // is instantiated. - // The name must contain only capital letters (A-Z), numbers (0-9), and - // underscores (_), and must not start with a number. The maximum length is - // 40 characters. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Paths to all fields that the parameter replaces. - // A field is allowed to appear in at most one parameter's list of field - // paths. - // - // A field path is similar in syntax to a - // [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a - // field path that references the zone field of a workflow template's cluster - // selector would be specified as `placement.clusterSelector.zone`. - // - // Also, field paths can reference fields using the following syntax: - // - // * Values in maps can be referenced by key: - // * labels['key'] - // * placement.clusterSelector.clusterLabels['key'] - // * placement.managedCluster.labels['key'] - // * placement.clusterSelector.clusterLabels['key'] - // * jobs['step-id'].labels['key'] - // - // * Jobs in the jobs list can be referenced by step-id: - // * jobs['step-id'].hadoopJob.mainJarFileUri - // * jobs['step-id'].hiveJob.queryFileUri - // * jobs['step-id'].pySparkJob.mainPythonFileUri - // * jobs['step-id'].hadoopJob.jarFileUris[0] - // * jobs['step-id'].hadoopJob.archiveUris[0] - // * jobs['step-id'].hadoopJob.fileUris[0] - // * jobs['step-id'].pySparkJob.pythonFileUris[0] - // - // * Items in repeated fields can be referenced by a zero-based index: - // * jobs['step-id'].sparkJob.args[0] - // - // * Other examples: - // * jobs['step-id'].hadoopJob.properties['key'] - // * jobs['step-id'].hadoopJob.args[0] - // * jobs['step-id'].hiveJob.scriptVariables['key'] - // * jobs['step-id'].hadoopJob.mainJarFileUri - // * placement.clusterSelector.zone - // - // It may not be possible to parameterize maps and repeated fields in their - // entirety since only individual map values and individual items in repeated - // fields can be referenced. For example, the following field paths are - // invalid: - // - // - placement.clusterSelector.clusterLabels - // - jobs['step-id'].sparkJob.args - repeated string fields = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Brief description of the parameter. - // Must not exceed 1024 characters. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Validation rules to be applied to this parameter's value. - ParameterValidation validation = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for parameter validation. -message ParameterValidation { - // Required. The type of validation to be performed. - oneof validation_type { - // Validation based on regular expressions. - RegexValidation regex = 1; - - // Validation based on a list of allowed values. - ValueValidation values = 2; - } -} - -// Validation based on regular expressions. -message RegexValidation { - // Required. RE2 regular expressions used to validate the parameter's value. - // The value must match the regex in its entirety (substring - // matches are not sufficient). - repeated string regexes = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Validation based on a list of allowed values. -message ValueValidation { - // Required. List of allowed values for the parameter. - repeated string values = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A Dataproc workflow template resource. -message WorkflowMetadata { - // The operation state. - enum State { - // Unused. - UNKNOWN = 0; - - // The operation has been created. - PENDING = 1; - - // The operation is running. - RUNNING = 2; - - // The operation is done; either cancelled or completed. - DONE = 3; - } - - // Output only. The resource name of the workflow template as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates`, the resource name of the - // template has the following format: - // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - // - // * For `projects.locations.workflowTemplates`, the resource name of the - // template has the following format: - // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - string template = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The version of template at the time of - // workflow instantiation. - int32 version = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create cluster operation metadata. - ClusterOperation create_cluster = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The workflow graph. - WorkflowGraph graph = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The delete cluster operation metadata. - ClusterOperation delete_cluster = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The workflow state. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the target cluster. - string cluster_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Map from parameter names to values that were used for those parameters. - map parameters = 8; - - // Output only. Workflow start time. - google.protobuf.Timestamp start_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Workflow end time. - google.protobuf.Timestamp end_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The UUID of target cluster. - string cluster_uuid = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timeout duration for the DAG of jobs, expressed in seconds - // (see [JSON representation of - // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - google.protobuf.Duration dag_timeout = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. DAG start time, only set for workflows with - // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when - // DAG begins. - google.protobuf.Timestamp dag_start_time = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. DAG end time, only set for workflows with - // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when - // DAG ends. - google.protobuf.Timestamp dag_end_time = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The cluster operation triggered by a workflow. -message ClusterOperation { - // Output only. The id of the cluster operation. - string operation_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Error, if operation failed. - string error = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates the operation is done. - bool done = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The workflow graph. -message WorkflowGraph { - // Output only. The workflow nodes. - repeated WorkflowNode nodes = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The workflow node. -message WorkflowNode { - // The workflow node state. - enum NodeState { - // State is unspecified. - NODE_STATE_UNSPECIFIED = 0; - - // The node is awaiting prerequisite node to finish. - BLOCKED = 1; - - // The node is runnable but not running. - RUNNABLE = 2; - - // The node is running. - RUNNING = 3; - - // The node completed successfully. - COMPLETED = 4; - - // The node failed. A node can be marked FAILED because - // its ancestor or peer failed. - FAILED = 5; - } - - // Output only. The name of the node. - string step_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Node's prerequisite nodes. - repeated string prerequisite_step_ids = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The job id; populated after the node enters RUNNING state. - string job_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The node state. - NodeState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The error detail. - string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request to create a workflow template. -message CreateWorkflowTemplateRequest { - // Required. The resource name of the region or location, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates.create`, the resource name of the - // region has the following format: - // `projects/{project_id}/regions/{region}` - // - // * For `projects.locations.workflowTemplates.create`, the resource name of - // the location has the following format: - // `projects/{project_id}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Required. The Dataproc workflow template to create. - WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to fetch a workflow template. -message GetWorkflowTemplateRequest { - // Required. The resource name of the workflow template, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates.get`, the resource name of the - // template has the following format: - // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - // - // * For `projects.locations.workflowTemplates.get`, the resource name of the - // template has the following format: - // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Optional. The version of workflow template to retrieve. Only previously - // instantiated versions can be retrieved. - // - // If unspecified, retrieves the current version. - int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to instantiate a workflow template. -message InstantiateWorkflowTemplateRequest { - // Required. The resource name of the workflow template, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates.instantiate`, the resource name - // of the template has the following format: - // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - // - // * For `projects.locations.workflowTemplates.instantiate`, the resource name - // of the template has the following format: - // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Optional. The version of workflow template to instantiate. If specified, - // the workflow will be instantiated only if the current version of - // the workflow template has the supplied version. - // - // This option cannot be used to instantiate a previous version of - // workflow template. - int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A tag that prevents multiple concurrent workflow - // instances with the same tag from running. This mitigates risk of - // concurrent instances started due to retries. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The tag must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Map from parameter names to values that should be used for those - // parameters. Values may not exceed 1000 characters. - map parameters = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to instantiate an inline workflow template. -message InstantiateInlineWorkflowTemplateRequest { - // Required. The resource name of the region or location, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates,instantiateinline`, the resource - // name of the region has the following format: - // `projects/{project_id}/regions/{region}` - // - // * For `projects.locations.workflowTemplates.instantiateinline`, the - // resource name of the location has the following format: - // `projects/{project_id}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Required. The workflow template to instantiate. - WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A tag that prevents multiple concurrent workflow - // instances with the same tag from running. This mitigates risk of - // concurrent instances started due to retries. - // - // It is recommended to always set this value to a - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - // - // The tag must contain only letters (a-z, A-Z), numbers (0-9), - // underscores (_), and hyphens (-). The maximum length is 40 characters. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request to update a workflow template. -message UpdateWorkflowTemplateRequest { - // Required. The updated workflow template. - // - // The `template.version` field must match the current version. - WorkflowTemplate template = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A request to list workflow templates in a project. -message ListWorkflowTemplatesRequest { - // Required. The resource name of the region or location, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates,list`, the resource - // name of the region has the following format: - // `projects/{project_id}/regions/{region}` - // - // * For `projects.locations.workflowTemplates.list`, the - // resource name of the location has the following format: - // `projects/{project_id}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Optional. The maximum number of results to return in each response. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The page token, returned by a previous call, to request the - // next page of results. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A response to a request to list workflow templates in a project. -message ListWorkflowTemplatesResponse { - // Output only. WorkflowTemplates list. - repeated WorkflowTemplate templates = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This token is included in the response if there are more - // results to fetch. To fetch additional results, provide this value as the - // page_token in a subsequent ListWorkflowTemplatesRequest. - string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request to delete a workflow template. -// -// Currently started workflows will remain running. -message DeleteWorkflowTemplateRequest { - // Required. The resource name of the workflow template, as described - // in https://cloud.google.com/apis/design/resource_names. - // - // * For `projects.regions.workflowTemplates.delete`, the resource name - // of the template has the following format: - // `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - // - // * For `projects.locations.workflowTemplates.instantiate`, the resource name - // of the template has the following format: - // `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dataproc.googleapis.com/WorkflowTemplate" - } - ]; - - // Optional. The version of workflow template to delete. If specified, - // will only delete the template if the current server version matches - // specified version. - int32 version = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js deleted file mode 100644 index ee5ff1ec06b2..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, policy) { - // [START dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.autoscalingPolicies.create`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * * For `projects.locations.autoscalingPolicies.create`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. The autoscaling policy to create. - */ - // const policy = {} - - // Imports the Dataproc library - const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new AutoscalingPolicyServiceClient(); - - async function callCreateAutoscalingPolicy() { - // Construct request - const request = { - parent, - policy, - }; - - // Run request - const response = await dataprocClient.createAutoscalingPolicy(request); - console.log(response); - } - - callCreateAutoscalingPolicy(); - // [END dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js deleted file mode 100644 index 029515322c03..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The "resource name" of the autoscaling policy, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.autoscalingPolicies.delete`, the resource name - * of the policy has the following format: - * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - * * For `projects.locations.autoscalingPolicies.delete`, the resource name - * of the policy has the following format: - * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - */ - // const name = 'abc123' - - // Imports the Dataproc library - const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new AutoscalingPolicyServiceClient(); - - async function callDeleteAutoscalingPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.deleteAutoscalingPolicy(request); - console.log(response); - } - - callDeleteAutoscalingPolicy(); - // [END dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js deleted file mode 100644 index 91ed92b26a0b..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The "resource name" of the autoscaling policy, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.autoscalingPolicies.get`, the resource name - * of the policy has the following format: - * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - * * For `projects.locations.autoscalingPolicies.get`, the resource name - * of the policy has the following format: - * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - */ - // const name = 'abc123' - - // Imports the Dataproc library - const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new AutoscalingPolicyServiceClient(); - - async function callGetAutoscalingPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.getAutoscalingPolicy(request); - console.log(response); - } - - callGetAutoscalingPolicy(); - // [END dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js deleted file mode 100644 index 690c60477e44..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.autoscalingPolicies.list`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * * For `projects.locations.autoscalingPolicies.list`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to return in each response. - * Must be less than or equal to 1000. Defaults to 100. - */ - // const pageSize = 1234 - /** - * Optional. The page token, returned by a previous call, to request the - * next page of results. - */ - // const pageToken = 'abc123' - - // Imports the Dataproc library - const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new AutoscalingPolicyServiceClient(); - - async function callListAutoscalingPolicies() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dataprocClient.listAutoscalingPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAutoscalingPolicies(); - // [END dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_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-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js deleted file mode 100644 index a506990a3cdf..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(policy) { - // [START dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_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 updated autoscaling policy. - */ - // const policy = {} - - // Imports the Dataproc library - const {AutoscalingPolicyServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new AutoscalingPolicyServiceClient(); - - async function callUpdateAutoscalingPolicy() { - // Construct request - const request = { - policy, - }; - - // Run request - const response = await dataprocClient.updateAutoscalingPolicy(request); - console.log(response); - } - - callUpdateAutoscalingPolicy(); - // [END dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_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-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js deleted file mode 100644 index e54566d6c157..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.create_batch.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, batch) { - // [START dataproc_v1_generated_BatchController_CreateBatch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where this batch will be created. - */ - // const parent = 'abc123' - /** - * Required. The batch to create. - */ - // const batch = {} - /** - * Optional. The ID to use for the batch, which will become the final - * component of the batch's resource name. - * This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`. - */ - // const batchId = 'abc123' - /** - * Optional. A unique ID used to identify the request. If the service - * receives two - * CreateBatchRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s - * with the same request_id, the second request is ignored and the - * Operation that corresponds to the first Batch created and stored - * in the backend is returned. - * Recommendation: Set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The value must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {BatchControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new BatchControllerClient(); - - async function callCreateBatch() { - // Construct request - const request = { - parent, - batch, - }; - - // Run request - const [operation] = await dataprocClient.createBatch(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBatch(); - // [END dataproc_v1_generated_BatchController_CreateBatch_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-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js deleted file mode 100644 index 7e59ec86a284..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.delete_batch.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_BatchController_DeleteBatch_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 fully qualified name of the batch to retrieve - * in the format - * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - */ - // const name = 'abc123' - - // Imports the Dataproc library - const {BatchControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new BatchControllerClient(); - - async function callDeleteBatch() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.deleteBatch(request); - console.log(response); - } - - callDeleteBatch(); - // [END dataproc_v1_generated_BatchController_DeleteBatch_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-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js deleted file mode 100644 index c1fe0b00cd88..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.get_batch.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_BatchController_GetBatch_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 fully qualified name of the batch to retrieve - * in the format - * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - */ - // const name = 'abc123' - - // Imports the Dataproc library - const {BatchControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new BatchControllerClient(); - - async function callGetBatch() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.getBatch(request); - console.log(response); - } - - callGetBatch(); - // [END dataproc_v1_generated_BatchController_GetBatch_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-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js deleted file mode 100644 index 74ef83b17c99..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/batch_controller.list_batches.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START dataproc_v1_generated_BatchController_ListBatches_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of batches. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of batches to return in each response. - * The service may return fewer than this value. - * The default page size is 20; the maximum page size is 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token received from a previous `ListBatches` call. - * Provide this token to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter for the batches to return in the response. - * A filter is a logical expression constraining the values of various fields - * in each batch resource. Filters are case sensitive, and may contain - * multiple clauses combined with logical operators (AND/OR). - * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. - * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` - * filters for batches in state RUNNING that were created before 2023-01-01 - * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed - * description of the filter syntax and a list of supported comparisons. - */ - // const filter = 'abc123' - /** - * Optional. Field(s) on which to sort the list of batches. - * Currently the only supported sort orders are unspecified (empty) and - * `create_time desc` to sort by most recently created batches first. - * See https://google.aip.dev/132#ordering for more details. - */ - // const orderBy = 'abc123' - - // Imports the Dataproc library - const {BatchControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new BatchControllerClient(); - - async function callListBatches() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dataprocClient.listBatchesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBatches(); - // [END dataproc_v1_generated_BatchController_ListBatches_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-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js deleted file mode 100644 index c14ef7388c71..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.create_cluster.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, cluster) { - // [START dataproc_v1_generated_ClusterController_CreateCluster_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 ID of the Google Cloud Platform project that the cluster - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster to create. - */ - // const cluster = {} - /** - * Optional. A unique ID used to identify the request. If the server receives - * two - * CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s - * with the same id, then the second request will be ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - /** - * Optional. Failure action when primary worker creation fails. - */ - // const actionOnFailedPrimaryWorkers = {} - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callCreateCluster() { - // Construct request - const request = { - projectId, - region, - cluster, - }; - - // Run request - const [operation] = await dataprocClient.createCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCluster(); - // [END dataproc_v1_generated_ClusterController_CreateCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js deleted file mode 100644 index 408dbe356cad..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.delete_cluster.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName) { - // [START dataproc_v1_generated_ClusterController_DeleteCluster_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 ID of the Google Cloud Platform project that the cluster - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - /** - * Optional. Specifying the `cluster_uuid` means the RPC should fail - * (with error NOT_FOUND) if cluster with specified UUID does not exist. - */ - // const clusterUuid = 'abc123' - /** - * Optional. A unique ID used to identify the request. If the server - * receives two - * DeleteClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s - * with the same id, then the second request will be ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callDeleteCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - }; - - // Run request - const [operation] = await dataprocClient.deleteCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteCluster(); - // [END dataproc_v1_generated_ClusterController_DeleteCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js deleted file mode 100644 index 78bbe9e700dd..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.diagnose_cluster.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName) { - // [START dataproc_v1_generated_ClusterController_DiagnoseCluster_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 ID of the Google Cloud Platform project that the cluster - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - /** - * Optional. The output Cloud Storage directory for the diagnostic - * tarball. If not specified, a task-specific directory in the cluster's - * staging bucket will be used. - */ - // const tarballGcsDir = 'abc123' - /** - * Optional. Time interval in which diagnosis should be carried out on the - * cluster. - */ - // const diagnosisInterval = {} - /** - * Optional. Specifies a list of jobs on which diagnosis is to be performed. - * Format: projects/{project}/regions/{region}/jobs/{job} - */ - // const jobs = ['abc','def'] - /** - * Optional. Specifies a list of yarn applications on which diagnosis is to be - * performed. - */ - // const yarnApplicationIds = ['abc','def'] - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callDiagnoseCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - }; - - // Run request - const [operation] = await dataprocClient.diagnoseCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDiagnoseCluster(); - // [END dataproc_v1_generated_ClusterController_DiagnoseCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js deleted file mode 100644 index 81b9a730c32e..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.get_cluster.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName) { - // [START dataproc_v1_generated_ClusterController_GetCluster_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 ID of the Google Cloud Platform project that the cluster - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callGetCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - }; - - // Run request - const response = await dataprocClient.getCluster(request); - console.log(response); - } - - callGetCluster(); - // [END dataproc_v1_generated_ClusterController_GetCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js deleted file mode 100644 index 1159de5a403a..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.list_clusters.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region) { - // [START dataproc_v1_generated_ClusterController_ListClusters_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 ID of the Google Cloud Platform project that the cluster - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Optional. A filter constraining the clusters to list. Filters are - * case-sensitive and have the following syntax: - * field = value AND field = value ... - * where **field** is one of `status.state`, `clusterName`, or `labels.KEY`, - * and `[KEY]` is a label key. **value** can be `*` to match all values. - * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, - * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` - * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` - * contains the `DELETING` and `ERROR` states. - * `clusterName` is the name of the cluster provided at creation time. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * Example filter: - * status.state = ACTIVE AND clusterName = mycluster - * AND labels.env = staging AND labels.starred = * - */ - // const filter = 'abc123' - /** - * Optional. The standard List page size. - */ - // const pageSize = 1234 - /** - * Optional. The standard List page token. - */ - // const pageToken = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callListClusters() { - // Construct request - const request = { - projectId, - region, - }; - - // Run request - const iterable = await dataprocClient.listClustersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListClusters(); - // [END dataproc_v1_generated_ClusterController_ListClusters_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-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js deleted file mode 100644 index 53742e7ef1f6..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.start_cluster.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName) { - // [START dataproc_v1_generated_ClusterController_StartCluster_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 ID of the Google Cloud Platform project the - * cluster belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - /** - * Optional. Specifying the `cluster_uuid` means the RPC will fail - * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - */ - // const clusterUuid = 'abc123' - /** - * Optional. A unique ID used to identify the request. If the server - * receives two - * StartClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s - * with the same id, then the second request will be ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * Recommendation: Set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callStartCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - }; - - // Run request - const [operation] = await dataprocClient.startCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStartCluster(); - // [END dataproc_v1_generated_ClusterController_StartCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js deleted file mode 100644 index 95679fabd3f2..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.stop_cluster.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName) { - // [START dataproc_v1_generated_ClusterController_StopCluster_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 ID of the Google Cloud Platform project the - * cluster belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - /** - * Optional. Specifying the `cluster_uuid` means the RPC will fail - * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - */ - // const clusterUuid = 'abc123' - /** - * Optional. A unique ID used to identify the request. If the server - * receives two - * StopClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s - * with the same id, then the second request will be ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * Recommendation: Set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callStopCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - }; - - // Run request - const [operation] = await dataprocClient.stopCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStopCluster(); - // [END dataproc_v1_generated_ClusterController_StopCluster_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-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js deleted file mode 100644 index 8a82e0b600f2..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/cluster_controller.update_cluster.js +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, clusterName, cluster, updateMask) { - // [START dataproc_v1_generated_ClusterController_UpdateCluster_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 ID of the Google Cloud Platform project the - * cluster belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The cluster name. - */ - // const clusterName = 'abc123' - /** - * Required. The changes to the cluster. - */ - // const cluster = {} - /** - * Optional. Timeout for graceful YARN decommissioning. Graceful - * decommissioning allows removing nodes from the cluster without - * interrupting jobs in progress. Timeout specifies how long to wait for jobs - * in progress to finish before forcefully removing nodes (and potentially - * interrupting jobs). Default timeout is 0 (for forceful decommission), and - * the maximum allowed timeout is 1 day. (see JSON representation of - * Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). - * Only supported on Dataproc image versions 1.2 and higher. - */ - // const gracefulDecommissionTimeout = {} - /** - * Required. Specifies the path, relative to `Cluster`, of - * the field to update. For example, to change the number of workers - * in a cluster to 5, the `update_mask` parameter would be - * specified as `config.worker_config.num_instances`, - * and the `PATCH` request body would specify the new value, as follows: - * { - * "config":{ - * "workerConfig":{ - * "numInstances":"5" - * } - * } - * } - * Similarly, to change the number of preemptible workers in a cluster to 5, - * the `update_mask` parameter would be - * `config.secondary_worker_config.num_instances`, and the `PATCH` request - * body would be set as follows: - * { - * "config":{ - * "secondaryWorkerConfig":{ - * "numInstances":"5" - * } - * } - * } - * Note: Currently, only the following fields can be updated: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or - * change autoscaling policies
- */ - // const updateMask = {} - /** - * Optional. A unique ID used to identify the request. If the server - * receives two - * UpdateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s - * with the same id, then the second request will be ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new ClusterControllerClient(); - - async function callUpdateCluster() { - // Construct request - const request = { - projectId, - region, - clusterName, - cluster, - updateMask, - }; - - // Run request - const [operation] = await dataprocClient.updateCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCluster(); - // [END dataproc_v1_generated_ClusterController_UpdateCluster_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-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js deleted file mode 100644 index 4f6219a3e3e0..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.cancel_job.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, jobId) { - // [START dataproc_v1_generated_JobController_CancelJob_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job ID. - */ - // const jobId = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callCancelJob() { - // Construct request - const request = { - projectId, - region, - jobId, - }; - - // Run request - const response = await dataprocClient.cancelJob(request); - console.log(response); - } - - callCancelJob(); - // [END dataproc_v1_generated_JobController_CancelJob_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-dataproc/v1/samples/generated/v1/job_controller.delete_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js deleted file mode 100644 index fd2e2d92dd6f..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.delete_job.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, jobId) { - // [START dataproc_v1_generated_JobController_DeleteJob_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job ID. - */ - // const jobId = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callDeleteJob() { - // Construct request - const request = { - projectId, - region, - jobId, - }; - - // Run request - const response = await dataprocClient.deleteJob(request); - console.log(response); - } - - callDeleteJob(); - // [END dataproc_v1_generated_JobController_DeleteJob_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-dataproc/v1/samples/generated/v1/job_controller.get_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js deleted file mode 100644 index eb284bf44722..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.get_job.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, jobId) { - // [START dataproc_v1_generated_JobController_GetJob_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job ID. - */ - // const jobId = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callGetJob() { - // Construct request - const request = { - projectId, - region, - jobId, - }; - - // Run request - const response = await dataprocClient.getJob(request); - console.log(response); - } - - callGetJob(); - // [END dataproc_v1_generated_JobController_GetJob_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-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js deleted file mode 100644 index 450e4faa272e..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.list_jobs.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region) { - // [START dataproc_v1_generated_JobController_ListJobs_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Optional. The number of results to return in each response. - */ - // const pageSize = 1234 - /** - * Optional. The page token, returned by a previous call, to request the - * next page of results. - */ - // const pageToken = 'abc123' - /** - * Optional. If set, the returned jobs list includes only jobs that were - * submitted to the named cluster. - */ - // const clusterName = 'abc123' - /** - * Optional. Specifies enumerated categories of jobs to list. - * (default = match ALL jobs). - * If `filter` is provided, `jobStateMatcher` will be ignored. - */ - // const jobStateMatcher = {} - /** - * Optional. A filter constraining the jobs to list. Filters are - * case-sensitive and have the following syntax: - * field = value AND field = value ... - * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label - * key. **value** can be `*` to match all values. - * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * Example filter: - * status.state = ACTIVE AND labels.env = staging AND labels.starred = * - */ - // const filter = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callListJobs() { - // Construct request - const request = { - projectId, - region, - }; - - // Run request - const iterable = await dataprocClient.listJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobs(); - // [END dataproc_v1_generated_JobController_ListJobs_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-dataproc/v1/samples/generated/v1/job_controller.submit_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js deleted file mode 100644 index 5fd939be15ab..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, job) { - // [START dataproc_v1_generated_JobController_SubmitJob_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job resource. - */ - // const job = {} - /** - * Optional. A unique id used to identify the request. If the server - * receives two - * SubmitJobRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s - * with the same id, then the second request will be ignored and the - * first Job google.cloud.dataproc.v1.Job created and stored in the backend - * is returned. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The id must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callSubmitJob() { - // Construct request - const request = { - projectId, - region, - job, - }; - - // Run request - const response = await dataprocClient.submitJob(request); - console.log(response); - } - - callSubmitJob(); - // [END dataproc_v1_generated_JobController_SubmitJob_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-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js deleted file mode 100644 index fa41a1642d7d..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.submit_job_as_operation.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, job) { - // [START dataproc_v1_generated_JobController_SubmitJobAsOperation_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job resource. - */ - // const job = {} - /** - * Optional. A unique id used to identify the request. If the server - * receives two - * SubmitJobRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s - * with the same id, then the second request will be ignored and the - * first Job google.cloud.dataproc.v1.Job created and stored in the backend - * is returned. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The id must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callSubmitJobAsOperation() { - // Construct request - const request = { - projectId, - region, - job, - }; - - // Run request - const [operation] = await dataprocClient.submitJobAsOperation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSubmitJobAsOperation(); - // [END dataproc_v1_generated_JobController_SubmitJobAsOperation_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-dataproc/v1/samples/generated/v1/job_controller.update_job.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js deleted file mode 100644 index a9cf7e0ea854..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/job_controller.update_job.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, region, jobId, job, updateMask) { - // [START dataproc_v1_generated_JobController_UpdateJob_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 ID of the Google Cloud Platform project that the job - * belongs to. - */ - // const projectId = 'abc123' - /** - * Required. The Dataproc region in which to handle the request. - */ - // const region = 'us-central1' - /** - * Required. The job ID. - */ - // const jobId = 'abc123' - /** - * Required. The changes to the job. - */ - // const job = {} - /** - * Required. Specifies the path, relative to Job, of - * the field to update. For example, to update the labels of a Job the - * update_mask parameter would be specified as - * labels, and the `PATCH` request body would specify the new - * value. Note: Currently, labels is the only - * field that can be updated. - */ - // const updateMask = {} - - // Imports the Dataproc library - const {JobControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new JobControllerClient(); - - async function callUpdateJob() { - // Construct request - const request = { - projectId, - region, - jobId, - job, - updateMask, - }; - - // Run request - const response = await dataprocClient.updateJob(request); - console.log(response); - } - - callUpdateJob(); - // [END dataproc_v1_generated_JobController_UpdateJob_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-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js deleted file mode 100644 index 330a781bd1cc..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.create_node_group.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, nodeGroup) { - // [START dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where this node group will be created. - * Format: `projects/{project}/regions/{region}/clusters/{cluster}` - */ - // const parent = 'abc123' - /** - * Required. The node group to create. - */ - // const nodeGroup = {} - /** - * Optional. An optional node group ID. Generated if not specified. - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). Cannot begin or end with underscore - * or hyphen. Must consist of from 3 to 33 characters. - */ - // const nodeGroupId = 'abc123' - /** - * Optional. A unique ID used to identify the request. If the server receives - * two - * CreateNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) - * with the same ID, the second request is ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * Recommendation: Set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new NodeGroupControllerClient(); - - async function callCreateNodeGroup() { - // Construct request - const request = { - parent, - nodeGroup, - }; - - // Run request - const [operation] = await dataprocClient.createNodeGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateNodeGroup(); - // [END dataproc_v1_generated_NodeGroupController_CreateNodeGroup_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-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js deleted file mode 100644 index 9ae8ae8a0ef2..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.get_node_group.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_NodeGroupController_GetNodeGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the node group to retrieve. - * Format: - * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - */ - // const name = 'abc123' - - // Imports the Dataproc library - const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new NodeGroupControllerClient(); - - async function callGetNodeGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.getNodeGroup(request); - console.log(response); - } - - callGetNodeGroup(); - // [END dataproc_v1_generated_NodeGroupController_GetNodeGroup_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-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js deleted file mode 100644 index 954d333b3b1b..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/node_group_controller.resize_node_group.js +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, size) { - // [START dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the node group to resize. - * Format: - * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - */ - // const name = 'abc123' - /** - * Required. The number of running instances for the node group to maintain. - * The group adds or removes instances to maintain the number of instances - * specified by this parameter. - */ - // const size = 1234 - /** - * Optional. A unique ID used to identify the request. If the server receives - * two - * ResizeNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) - * with the same ID, the second request is ignored and the - * first google.longrunning.Operation google.longrunning.Operation created - * and stored in the backend is returned. - * Recommendation: Set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - /** - * Optional. Timeout for graceful YARN decommissioning. Graceful - * decommissioning - * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) - * allows the removal of nodes from the Compute Engine node group - * without interrupting jobs in progress. This timeout specifies how long to - * wait for jobs in progress to finish before forcefully removing nodes (and - * potentially interrupting jobs). Default timeout is 0 (for forceful - * decommission), and the maximum allowed timeout is 1 day. (see JSON - * representation of - * Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). - * Only supported on Dataproc image versions 1.2 and higher. - */ - // const gracefulDecommissionTimeout = {} - - // Imports the Dataproc library - const {NodeGroupControllerClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new NodeGroupControllerClient(); - - async function callResizeNodeGroup() { - // Construct request - const request = { - name, - size, - }; - - // Run request - const [operation] = await dataprocClient.resizeNodeGroup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callResizeNodeGroup(); - // [END dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_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-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json deleted file mode 100644 index 02bce0bdb368..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json +++ /dev/null @@ -1,1703 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dataproc", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.dataproc.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async", - "title": "dataproc createAutoscalingPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates new autoscaling policy.", - "canonical": true, - "file": "autoscaling_policy_service.create_autoscaling_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.CreateAutoscalingPolicy", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.cloud.dataproc.v1.AutoscalingPolicy" - } - ], - "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", - "client": { - "shortName": "AutoscalingPolicyServiceClient", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" - }, - "method": { - "shortName": "CreateAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.CreateAutoscalingPolicy", - "service": { - "shortName": "AutoscalingPolicyService", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_async", - "title": "dataproc updateAutoscalingPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates (replaces) autoscaling policy. Disabled check for update_mask, because all updates will be full replacements.", - "canonical": true, - "file": "autoscaling_policy_service.update_autoscaling_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.UpdateAutoscalingPolicy", - "async": true, - "parameters": [ - { - "name": "policy", - "type": ".google.cloud.dataproc.v1.AutoscalingPolicy" - } - ], - "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", - "client": { - "shortName": "AutoscalingPolicyServiceClient", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" - }, - "method": { - "shortName": "UpdateAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.UpdateAutoscalingPolicy", - "service": { - "shortName": "AutoscalingPolicyService", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async", - "title": "dataproc getAutoscalingPolicy Sample", - "origin": "API_DEFINITION", - "description": " Retrieves autoscaling policy.", - "canonical": true, - "file": "autoscaling_policy_service.get_autoscaling_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.GetAutoscalingPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.AutoscalingPolicy", - "client": { - "shortName": "AutoscalingPolicyServiceClient", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" - }, - "method": { - "shortName": "GetAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.GetAutoscalingPolicy", - "service": { - "shortName": "AutoscalingPolicyService", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async", - "title": "dataproc listAutoscalingPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists autoscaling policies in the project.", - "canonical": true, - "file": "autoscaling_policy_service.list_autoscaling_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAutoscalingPolicies", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.ListAutoscalingPolicies", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse", - "client": { - "shortName": "AutoscalingPolicyServiceClient", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" - }, - "method": { - "shortName": "ListAutoscalingPolicies", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.ListAutoscalingPolicies", - "service": { - "shortName": "AutoscalingPolicyService", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async", - "title": "dataproc deleteAutoscalingPolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.", - "canonical": true, - "file": "autoscaling_policy_service.delete_autoscaling_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.DeleteAutoscalingPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AutoscalingPolicyServiceClient", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyServiceClient" - }, - "method": { - "shortName": "DeleteAutoscalingPolicy", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService.DeleteAutoscalingPolicy", - "service": { - "shortName": "AutoscalingPolicyService", - "fullName": "google.cloud.dataproc.v1.AutoscalingPolicyService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_BatchController_CreateBatch_async", - "title": "dataproc createBatch Sample", - "origin": "API_DEFINITION", - "description": " Creates a batch workload that executes asynchronously.", - "canonical": true, - "file": "batch_controller.create_batch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.CreateBatch", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "batch", - "type": ".google.cloud.dataproc.v1.Batch" - }, - { - "name": "batch_id", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BatchControllerClient", - "fullName": "google.cloud.dataproc.v1.BatchControllerClient" - }, - "method": { - "shortName": "CreateBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.CreateBatch", - "service": { - "shortName": "BatchController", - "fullName": "google.cloud.dataproc.v1.BatchController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_BatchController_GetBatch_async", - "title": "dataproc getBatch Sample", - "origin": "API_DEFINITION", - "description": " Gets the batch workload resource representation.", - "canonical": true, - "file": "batch_controller.get_batch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.GetBatch", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.Batch", - "client": { - "shortName": "BatchControllerClient", - "fullName": "google.cloud.dataproc.v1.BatchControllerClient" - }, - "method": { - "shortName": "GetBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.GetBatch", - "service": { - "shortName": "BatchController", - "fullName": "google.cloud.dataproc.v1.BatchController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_BatchController_ListBatches_async", - "title": "dataproc listBatches Sample", - "origin": "API_DEFINITION", - "description": " Lists batch workloads.", - "canonical": true, - "file": "batch_controller.list_batches.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBatches", - "fullName": "google.cloud.dataproc.v1.BatchController.ListBatches", - "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.dataproc.v1.ListBatchesResponse", - "client": { - "shortName": "BatchControllerClient", - "fullName": "google.cloud.dataproc.v1.BatchControllerClient" - }, - "method": { - "shortName": "ListBatches", - "fullName": "google.cloud.dataproc.v1.BatchController.ListBatches", - "service": { - "shortName": "BatchController", - "fullName": "google.cloud.dataproc.v1.BatchController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_BatchController_DeleteBatch_async", - "title": "dataproc deleteBatch Sample", - "origin": "API_DEFINITION", - "description": " Deletes the batch workload resource. If the batch is not in terminal state, the delete fails and the response returns `FAILED_PRECONDITION`.", - "canonical": true, - "file": "batch_controller.delete_batch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.DeleteBatch", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BatchControllerClient", - "fullName": "google.cloud.dataproc.v1.BatchControllerClient" - }, - "method": { - "shortName": "DeleteBatch", - "fullName": "google.cloud.dataproc.v1.BatchController.DeleteBatch", - "service": { - "shortName": "BatchController", - "fullName": "google.cloud.dataproc.v1.BatchController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_CreateCluster_async", - "title": "dataproc createCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).", - "canonical": true, - "file": "cluster_controller.create_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.CreateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.cloud.dataproc.v1.Cluster" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "action_on_failed_primary_workers", - "type": ".google.cloud.dataproc.v1.FailureAction" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "CreateCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.CreateCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_UpdateCluster_async", - "title": "dataproc updateCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error is returned.", - "canonical": true, - "file": "cluster_controller.update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 146, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.UpdateCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.cloud.dataproc.v1.Cluster" - }, - { - "name": "graceful_decommission_timeout", - "type": ".google.protobuf.Duration" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "UpdateCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.UpdateCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_StopCluster_async", - "title": "dataproc stopCluster Sample", - "origin": "API_DEFINITION", - "description": " Stops a cluster in a project.", - "canonical": true, - "file": "cluster_controller.stop_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.StopCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "cluster_uuid", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "StopCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.StopCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_StartCluster_async", - "title": "dataproc startCluster Sample", - "origin": "API_DEFINITION", - "description": " Starts a cluster in a project.", - "canonical": true, - "file": "cluster_controller.start_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.StartCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "cluster_uuid", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "StartCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.StartCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_DeleteCluster_async", - "title": "dataproc deleteCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).", - "canonical": true, - "file": "cluster_controller.delete_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.DeleteCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "cluster_uuid", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "DeleteCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.DeleteCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_GetCluster_async", - "title": "dataproc getCluster Sample", - "origin": "API_DEFINITION", - "description": " Gets the resource representation for a cluster in a project.", - "canonical": true, - "file": "cluster_controller.get_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.GetCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.Cluster", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "GetCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.GetCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_ListClusters_async", - "title": "dataproc listClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists all regions/{region}/clusters in a project alphabetically.", - "canonical": true, - "file": "cluster_controller.list_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListClusters", - "fullName": "google.cloud.dataproc.v1.ClusterController.ListClusters", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.ListClustersResponse", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "ListClusters", - "fullName": "google.cloud.dataproc.v1.ClusterController.ListClusters", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_ClusterController_DiagnoseCluster_async", - "title": "dataproc diagnoseCluster Sample", - "origin": "API_DEFINITION", - "description": " Gets cluster diagnostic information. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, [Operation.response][google.longrunning.Operation.response] contains [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).", - "canonical": true, - "file": "cluster_controller.diagnose_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DiagnoseCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.DiagnoseCluster", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "tarball_gcs_dir", - "type": "TYPE_STRING" - }, - { - "name": "diagnosis_interval", - "type": ".google.type.Interval" - }, - { - "name": "jobs", - "type": "TYPE_STRING[]" - }, - { - "name": "yarn_application_ids", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ClusterControllerClient", - "fullName": "google.cloud.dataproc.v1.ClusterControllerClient" - }, - "method": { - "shortName": "DiagnoseCluster", - "fullName": "google.cloud.dataproc.v1.ClusterController.DiagnoseCluster", - "service": { - "shortName": "ClusterController", - "fullName": "google.cloud.dataproc.v1.ClusterController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_SubmitJob_async", - "title": "dataproc submitJob Sample", - "origin": "API_DEFINITION", - "description": " Submits a job to a cluster.", - "canonical": true, - "file": "job_controller.submit_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SubmitJob", - "fullName": "google.cloud.dataproc.v1.JobController.SubmitJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.dataproc.v1.Job" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.Job", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "SubmitJob", - "fullName": "google.cloud.dataproc.v1.JobController.SubmitJob", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_SubmitJobAsOperation_async", - "title": "dataproc submitJobAsOperation Sample", - "origin": "API_DEFINITION", - "description": " Submits job to a cluster.", - "canonical": true, - "file": "job_controller.submit_job_as_operation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SubmitJobAsOperation", - "fullName": "google.cloud.dataproc.v1.JobController.SubmitJobAsOperation", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.dataproc.v1.Job" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "SubmitJobAsOperation", - "fullName": "google.cloud.dataproc.v1.JobController.SubmitJobAsOperation", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_GetJob_async", - "title": "dataproc getJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the resource representation for a job in a project.", - "canonical": true, - "file": "job_controller.get_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJob", - "fullName": "google.cloud.dataproc.v1.JobController.GetJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.Job", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "GetJob", - "fullName": "google.cloud.dataproc.v1.JobController.GetJob", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_ListJobs_async", - "title": "dataproc listJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists regions/{region}/jobs in a project.", - "canonical": true, - "file": "job_controller.list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 94, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobs", - "fullName": "google.cloud.dataproc.v1.JobController.ListJobs", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "cluster_name", - "type": "TYPE_STRING" - }, - { - "name": "job_state_matcher", - "type": ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.ListJobsResponse", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "ListJobs", - "fullName": "google.cloud.dataproc.v1.JobController.ListJobs", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_UpdateJob_async", - "title": "dataproc updateJob Sample", - "origin": "API_DEFINITION", - "description": " Updates a job in a project.", - "canonical": true, - "file": "job_controller.update_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateJob", - "fullName": "google.cloud.dataproc.v1.JobController.UpdateJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.dataproc.v1.Job" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dataproc.v1.Job", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "UpdateJob", - "fullName": "google.cloud.dataproc.v1.JobController.UpdateJob", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_CancelJob_async", - "title": "dataproc cancelJob Sample", - "origin": "API_DEFINITION", - "description": " Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).", - "canonical": true, - "file": "job_controller.cancel_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelJob", - "fullName": "google.cloud.dataproc.v1.JobController.CancelJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.Job", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "CancelJob", - "fullName": "google.cloud.dataproc.v1.JobController.CancelJob", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_JobController_DeleteJob_async", - "title": "dataproc deleteJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`.", - "canonical": true, - "file": "job_controller.delete_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJob", - "fullName": "google.cloud.dataproc.v1.JobController.DeleteJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "JobControllerClient", - "fullName": "google.cloud.dataproc.v1.JobControllerClient" - }, - "method": { - "shortName": "DeleteJob", - "fullName": "google.cloud.dataproc.v1.JobController.DeleteJob", - "service": { - "shortName": "JobController", - "fullName": "google.cloud.dataproc.v1.JobController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async", - "title": "dataproc createNodeGroup Sample", - "origin": "API_DEFINITION", - "description": " Creates a node group in a cluster. The returned [Operation.metadata][google.longrunning.Operation.metadata] is [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).", - "canonical": true, - "file": "node_group_controller.create_node_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.CreateNodeGroup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "node_group", - "type": ".google.cloud.dataproc.v1.NodeGroup" - }, - { - "name": "node_group_id", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "NodeGroupControllerClient", - "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" - }, - "method": { - "shortName": "CreateNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.CreateNodeGroup", - "service": { - "shortName": "NodeGroupController", - "fullName": "google.cloud.dataproc.v1.NodeGroupController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async", - "title": "dataproc resizeNodeGroup Sample", - "origin": "API_DEFINITION", - "description": " Resizes a node group in a cluster. The returned [Operation.metadata][google.longrunning.Operation.metadata] is [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).", - "canonical": true, - "file": "node_group_controller.resize_node_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResizeNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.ResizeNodeGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "size", - "type": "TYPE_INT32" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "graceful_decommission_timeout", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "NodeGroupControllerClient", - "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" - }, - "method": { - "shortName": "ResizeNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.ResizeNodeGroup", - "service": { - "shortName": "NodeGroupController", - "fullName": "google.cloud.dataproc.v1.NodeGroupController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_NodeGroupController_GetNodeGroup_async", - "title": "dataproc getNodeGroup Sample", - "origin": "API_DEFINITION", - "description": " Gets the resource representation for a node group in a cluster.", - "canonical": true, - "file": "node_group_controller.get_node_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.GetNodeGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.NodeGroup", - "client": { - "shortName": "NodeGroupControllerClient", - "fullName": "google.cloud.dataproc.v1.NodeGroupControllerClient" - }, - "method": { - "shortName": "GetNodeGroup", - "fullName": "google.cloud.dataproc.v1.NodeGroupController.GetNodeGroup", - "service": { - "shortName": "NodeGroupController", - "fullName": "google.cloud.dataproc.v1.NodeGroupController" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async", - "title": "dataproc createWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates new workflow template.", - "canonical": true, - "file": "workflow_template_service.create_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "template", - "type": ".google.cloud.dataproc.v1.WorkflowTemplate" - } - ], - "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "CreateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async", - "title": "dataproc getWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the latest workflow template. Can retrieve previously instantiated template by specifying optional version parameter.", - "canonical": true, - "file": "workflow_template_service.get_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.GetWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "GetWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.GetWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async", - "title": "dataproc instantiateWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Instantiates a template and begins execution. The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished. The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted. The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see [Using WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].", - "canonical": true, - "file": "workflow_template_service.instantiate_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InstantiateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version", - "type": "TYPE_INT32" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "parameters", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "InstantiateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async", - "title": "dataproc instantiateInlineWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Instantiates a template and begins execution. This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished. The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted. The [Operation.metadata][google.longrunning.Operation.metadata] will be [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see [Using WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty].", - "canonical": true, - "file": "workflow_template_service.instantiate_inline_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InstantiateInlineWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateInlineWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "template", - "type": ".google.cloud.dataproc.v1.WorkflowTemplate" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "InstantiateInlineWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateInlineWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_async", - "title": "dataproc updateWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates (replaces) workflow template. The updated template must contain version that matches the current server version.", - "canonical": true, - "file": "workflow_template_service.update_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.UpdateWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "template", - "type": ".google.cloud.dataproc.v1.WorkflowTemplate" - } - ], - "resultType": ".google.cloud.dataproc.v1.WorkflowTemplate", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "UpdateWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.UpdateWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async", - "title": "dataproc listWorkflowTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists workflows that match the specified filter in the request.", - "canonical": true, - "file": "workflow_template_service.list_workflow_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflowTemplates", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.ListWorkflowTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dataproc.v1.ListWorkflowTemplatesResponse", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "ListWorkflowTemplates", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.ListWorkflowTemplates", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - }, - { - "regionTag": "dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async", - "title": "dataproc deleteWorkflowTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes a workflow template. It does not cancel in-progress workflows.", - "canonical": true, - "file": "workflow_template_service.delete_workflow_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WorkflowTemplateServiceClient", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateServiceClient" - }, - "method": { - "shortName": "DeleteWorkflowTemplate", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate", - "service": { - "shortName": "WorkflowTemplateService", - "fullName": "google.cloud.dataproc.v1.WorkflowTemplateService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js deleted file mode 100644 index d9c8feeafd13..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.create_workflow_template.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, template) { - // [START dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates.create`, the resource name of the - * region has the following format: - * `projects/{project_id}/regions/{region}` - * * For `projects.locations.workflowTemplates.create`, the resource name of - * the location has the following format: - * `projects/{project_id}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. The Dataproc workflow template to create. - */ - // const template = {} - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callCreateWorkflowTemplate() { - // Construct request - const request = { - parent, - template, - }; - - // Run request - const response = await dataprocClient.createWorkflowTemplate(request); - console.log(response); - } - - callCreateWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js deleted file mode 100644 index bf139ac9534a..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.delete_workflow_template.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates.delete`, the resource name - * of the template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * * For `projects.locations.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - */ - // const name = 'abc123' - /** - * Optional. The version of workflow template to delete. If specified, - * will only delete the template if the current server version matches - * specified version. - */ - // const version = 1234 - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callDeleteWorkflowTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.deleteWorkflowTemplate(request); - console.log(response); - } - - callDeleteWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js deleted file mode 100644 index e3cd6692cb77..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.get_workflow_template.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates.get`, the resource name of the - * template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * * For `projects.locations.workflowTemplates.get`, the resource name of the - * template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - */ - // const name = 'abc123' - /** - * Optional. The version of workflow template to retrieve. Only previously - * instantiated versions can be retrieved. - * If unspecified, retrieves the current version. - */ - // const version = 1234 - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callGetWorkflowTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dataprocClient.getWorkflowTemplate(request); - console.log(response); - } - - callGetWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js deleted file mode 100644 index b63dc5afe9df..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, template) { - // [START dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates,instantiateinline`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * * For `projects.locations.workflowTemplates.instantiateinline`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. The workflow template to instantiate. - */ - // const template = {} - /** - * Optional. A tag that prevents multiple concurrent workflow - * instances with the same tag from running. This mitigates risk of - * concurrent instances started due to retries. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The tag must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callInstantiateInlineWorkflowTemplate() { - // Construct request - const request = { - parent, - template, - }; - - // Run request - const [operation] = await dataprocClient.instantiateInlineWorkflowTemplate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callInstantiateInlineWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js deleted file mode 100644 index 6825252807ba..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.instantiate_workflow_template.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * * For `projects.locations.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - */ - // const name = 'abc123' - /** - * Optional. The version of workflow template to instantiate. If specified, - * the workflow will be instantiated only if the current version of - * the workflow template has the supplied version. - * This option cannot be used to instantiate a previous version of - * workflow template. - */ - // const version = 1234 - /** - * Optional. A tag that prevents multiple concurrent workflow - * instances with the same tag from running. This mitigates risk of - * concurrent instances started due to retries. - * It is recommended to always set this value to a - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier). - * The tag must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - */ - // const requestId = 'abc123' - /** - * Optional. Map from parameter names to values that should be used for those - * parameters. Values may not exceed 1000 characters. - */ - // const parameters = [1,2,3,4] - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callInstantiateWorkflowTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dataprocClient.instantiateWorkflowTemplate(request); - const [response] = await operation.promise(); - console.log(response); - } - - callInstantiateWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_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-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js deleted file mode 100644 index 664d3fb20f6b..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.list_workflow_templates.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * * For `projects.regions.workflowTemplates,list`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * * For `projects.locations.workflowTemplates.list`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to return in each response. - */ - // const pageSize = 1234 - /** - * Optional. The page token, returned by a previous call, to request the - * next page of results. - */ - // const pageToken = 'abc123' - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callListWorkflowTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dataprocClient.listWorkflowTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkflowTemplates(); - // [END dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_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-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js b/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js deleted file mode 100644 index afe4c4b9a550..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/samples/generated/v1/workflow_template_service.update_workflow_template.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(template) { - // [START dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_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 updated workflow template. - * The `template.version` field must match the current version. - */ - // const template = {} - - // Imports the Dataproc library - const {WorkflowTemplateServiceClient} = require('@google-cloud/dataproc').v1; - - // Instantiates a client - const dataprocClient = new WorkflowTemplateServiceClient(); - - async function callUpdateWorkflowTemplate() { - // Construct request - const request = { - template, - }; - - // Run request - const response = await dataprocClient.updateWorkflowTemplate(request); - console.log(response); - } - - callUpdateWorkflowTemplate(); - // [END dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_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-dataproc/v1/src/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/index.ts deleted file mode 100644 index 57d81e8f280a..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const AutoscalingPolicyServiceClient = v1.AutoscalingPolicyServiceClient; -type AutoscalingPolicyServiceClient = v1.AutoscalingPolicyServiceClient; -const BatchControllerClient = v1.BatchControllerClient; -type BatchControllerClient = v1.BatchControllerClient; -const ClusterControllerClient = v1.ClusterControllerClient; -type ClusterControllerClient = v1.ClusterControllerClient; -const JobControllerClient = v1.JobControllerClient; -type JobControllerClient = v1.JobControllerClient; -const NodeGroupControllerClient = v1.NodeGroupControllerClient; -type NodeGroupControllerClient = v1.NodeGroupControllerClient; -const WorkflowTemplateServiceClient = v1.WorkflowTemplateServiceClient; -type WorkflowTemplateServiceClient = v1.WorkflowTemplateServiceClient; -export {v1, AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient}; -export default {v1, AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts deleted file mode 100644 index e5e3e37096a5..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client.ts +++ /dev/null @@ -1,1374 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos} 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/autoscaling_policy_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './autoscaling_policy_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The API interface for managing autoscaling policies in the - * Dataproc API. - * @class - * @memberof v1 - */ -export class AutoscalingPolicyServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - autoscalingPolicyServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AutoscalingPolicyServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 AutoscalingPolicyServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AutoscalingPolicyServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - }; - - // 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 = { - listAutoscalingPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'policies') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.AutoscalingPolicyService', 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.autoscalingPolicyServiceStub) { - return this.autoscalingPolicyServiceStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.AutoscalingPolicyService. - this.autoscalingPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.AutoscalingPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.AutoscalingPolicyService, - 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 autoscalingPolicyServiceStubMethods = - ['createAutoscalingPolicy', 'updateAutoscalingPolicy', 'getAutoscalingPolicy', 'listAutoscalingPolicies', 'deleteAutoscalingPolicy']; - for (const methodName of autoscalingPolicyServiceStubMethods) { - const callPromise = this.autoscalingPolicyServiceStub.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] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.autoscalingPolicyServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 -- - // ------------------- -/** - * Creates new autoscaling policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.create`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.autoscalingPolicies.create`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {google.cloud.dataproc.v1.AutoscalingPolicy} request.policy - * Required. The autoscaling policy to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/autoscaling_policy_service.create_autoscaling_policy.js - * region_tag:dataproc_v1_generated_AutoscalingPolicyService_CreateAutoscalingPolicy_async - */ - createAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|undefined, {}|undefined - ]>; - createAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.ICreateAutoscalingPolicyRequest|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.createAutoscalingPolicy(request, options, callback); - } -/** - * Updates (replaces) autoscaling policy. - * - * Disabled check for update_mask, because all updates will be full - * replacements. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dataproc.v1.AutoscalingPolicy} request.policy - * Required. The updated autoscaling policy. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/autoscaling_policy_service.update_autoscaling_policy.js - * region_tag:dataproc_v1_generated_AutoscalingPolicyService_UpdateAutoscalingPolicy_async - */ - updateAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|undefined, {}|undefined - ]>; - updateAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IUpdateAutoscalingPolicyRequest|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({ - 'policy.name': request.policy!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAutoscalingPolicy(request, options, callback); - } -/** - * Retrieves autoscaling policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The "resource name" of the autoscaling policy, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.get`, the resource name - * of the policy has the following format: - * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - * - * * For `projects.locations.autoscalingPolicies.get`, the resource name - * of the policy has the following format: - * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/autoscaling_policy_service.get_autoscaling_policy.js - * region_tag:dataproc_v1_generated_AutoscalingPolicyService_GetAutoscalingPolicy_async - */ - getAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|undefined, {}|undefined - ]>; - getAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy, - protos.google.cloud.dataproc.v1.IGetAutoscalingPolicyRequest|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.getAutoscalingPolicy(request, options, callback); - } -/** - * Deletes an autoscaling policy. It is an error to delete an autoscaling - * policy that is in use by one or more clusters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The "resource name" of the autoscaling policy, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.delete`, the resource name - * of the policy has the following format: - * `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` - * - * * For `projects.locations.autoscalingPolicies.delete`, the resource name - * of the policy has the following format: - * `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/autoscaling_policy_service.delete_autoscaling_policy.js - * region_tag:dataproc_v1_generated_AutoscalingPolicyService_DeleteAutoscalingPolicy_async - */ - deleteAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|undefined, {}|undefined - ]>; - deleteAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAutoscalingPolicy( - request: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAutoscalingPolicy( - request?: protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteAutoscalingPolicyRequest|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.deleteAutoscalingPolicy(request, options, callback); - } - - /** - * Lists autoscaling policies in the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.list`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.autoscalingPolicies.list`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * Must be less than or equal to 1000. Defaults to 100. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. - * 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 `listAutoscalingPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAutoscalingPolicies( - request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy[], - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest|null, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse - ]>; - listAutoscalingPolicies( - request: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): void; - listAutoscalingPolicies( - request: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): void; - listAutoscalingPolicies( - request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IAutoscalingPolicy>, - callback?: PaginationCallback< - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IAutoscalingPolicy>): - Promise<[ - protos.google.cloud.dataproc.v1.IAutoscalingPolicy[], - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest|null, - protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.listAutoscalingPolicies(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 "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.list`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.autoscalingPolicies.list`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * Must be less than or equal to 1000. Defaults to 100. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy} 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 `listAutoscalingPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listAutoscalingPoliciesStream( - request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - 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['listAutoscalingPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAutoscalingPolicies.createStream( - this.innerApiCalls.listAutoscalingPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAutoscalingPolicies`, 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 "resource name" of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.autoscalingPolicies.list`, the resource name - * of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.autoscalingPolicies.list`, the resource name - * of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * Must be less than or equal to 1000. Defaults to 100. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.dataproc.v1.AutoscalingPolicy|AutoscalingPolicy}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/autoscaling_policy_service.list_autoscaling_policies.js - * region_tag:dataproc_v1_generated_AutoscalingPolicyService_ListAutoscalingPolicies_async - */ - listAutoscalingPoliciesAsync( - request?: protos.google.cloud.dataproc.v1.IListAutoscalingPoliciesRequest, - 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['listAutoscalingPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAutoscalingPolicies.asyncIterate( - this.innerApiCalls['listAutoscalingPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * 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 nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * 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 projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * 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.autoscalingPolicyServiceStub && !this._terminated) { - return this.autoscalingPolicyServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json deleted file mode 100644 index 09bd892268fc..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.AutoscalingPolicyService": { - "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": { - "CreateAutoscalingPolicy": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAutoscalingPolicy": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetAutoscalingPolicy": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAutoscalingPolicies": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteAutoscalingPolicy": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/autoscaling_policy_service_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts deleted file mode 100644 index c7a2486815f0..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client.ts +++ /dev/null @@ -1,1560 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/batch_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './batch_controller_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The BatchController provides methods to manage batch workloads. - * @class - * @memberof v1 - */ -export class BatchControllerClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - batchControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BatchControllerClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 BatchControllerClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BatchControllerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - }; - - // 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 = { - listBatches: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'batches') - }; - - 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) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createBatchResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Batch') as gax.protobuf.Type; - const createBatchMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.BatchOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBatch: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBatchResponse.decode.bind(createBatchResponse), - createBatchMetadata.decode.bind(createBatchMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.BatchController', 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.batchControllerStub) { - return this.batchControllerStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.BatchController. - this.batchControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.BatchController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.BatchController, - 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 batchControllerStubMethods = - ['createBatch', 'getBatch', 'listBatches', 'deleteBatch']; - for (const methodName of batchControllerStubMethods) { - const callPromise = this.batchControllerStub.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.batchControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 batch workload resource representation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fully qualified name of the batch to retrieve - * in the format - * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Batch|Batch}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/batch_controller.get_batch.js - * region_tag:dataproc_v1_generated_BatchController_GetBatch_async - */ - getBatch( - request?: protos.google.cloud.dataproc.v1.IGetBatchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|undefined, {}|undefined - ]>; - getBatch( - request: protos.google.cloud.dataproc.v1.IGetBatchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, - {}|null|undefined>): void; - getBatch( - request: protos.google.cloud.dataproc.v1.IGetBatchRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, - {}|null|undefined>): void; - getBatch( - request?: protos.google.cloud.dataproc.v1.IGetBatchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IBatch, - protos.google.cloud.dataproc.v1.IGetBatchRequest|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.getBatch(request, options, callback); - } -/** - * Deletes the batch workload resource. If the batch is not in terminal state, - * the delete fails and the response returns `FAILED_PRECONDITION`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fully qualified name of the batch to retrieve - * in the format - * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/batch_controller.delete_batch.js - * region_tag:dataproc_v1_generated_BatchController_DeleteBatch_async - */ - deleteBatch( - request?: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|undefined, {}|undefined - ]>; - deleteBatch( - request: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, - {}|null|undefined>): void; - deleteBatch( - request: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, - {}|null|undefined>): void; - deleteBatch( - request?: protos.google.cloud.dataproc.v1.IDeleteBatchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteBatchRequest|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.deleteBatch(request, options, callback); - } - -/** - * Creates a batch workload that executes asynchronously. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this batch will be created. - * @param {google.cloud.dataproc.v1.Batch} request.batch - * Required. The batch to create. - * @param {string} [request.batchId] - * Optional. The ID to use for the batch, which will become the final - * component of the batch's resource name. - * - * This value must be 4-63 characters. Valid characters are `/{@link protos.0-9|a-z}-/`. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the service - * receives two - * [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s - * with the same request_id, the second request is ignored and the - * Operation that corresponds to the first Batch created and stored - * in the backend is returned. - * - * Recommendation: Set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The value must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/batch_controller.create_batch.js - * region_tag:dataproc_v1_generated_BatchController_CreateBatch_async - */ - createBatch( - request?: protos.google.cloud.dataproc.v1.ICreateBatchRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBatch( - request: protos.google.cloud.dataproc.v1.ICreateBatchRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBatch( - request: protos.google.cloud.dataproc.v1.ICreateBatchRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBatch( - request?: protos.google.cloud.dataproc.v1.ICreateBatchRequest, - 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.createBatch(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBatch()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/batch_controller.create_batch.js - * region_tag:dataproc_v1_generated_BatchController_CreateBatch_async - */ - async checkCreateBatchProgress(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.createBatch, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists batch workloads. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of batches. - * @param {number} [request.pageSize] - * Optional. The maximum number of batches to return in each response. - * The service may return fewer than this value. - * The default page size is 20; the maximum page size is 1000. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous `ListBatches` call. - * Provide this token to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter for the batches to return in the response. - * - * A filter is a logical expression constraining the values of various fields - * in each batch resource. Filters are case sensitive, and may contain - * multiple clauses combined with logical operators (AND/OR). - * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. - * - * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` - * filters for batches in state RUNNING that were created before 2023-01-01 - * - * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed - * description of the filter syntax and a list of supported comparisons. - * @param {string} [request.orderBy] - * Optional. Field(s) on which to sort the list of batches. - * - * Currently the only supported sort orders are unspecified (empty) and - * `create_time desc` to sort by most recently created batches first. - * - * See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Batch|Batch}. - * 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 `listBatchesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBatches( - request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IBatch[], - protos.google.cloud.dataproc.v1.IListBatchesRequest|null, - protos.google.cloud.dataproc.v1.IListBatchesResponse - ]>; - listBatches( - request: protos.google.cloud.dataproc.v1.IListBatchesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListBatchesRequest, - protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IBatch>): void; - listBatches( - request: protos.google.cloud.dataproc.v1.IListBatchesRequest, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListBatchesRequest, - protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IBatch>): void; - listBatches( - request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dataproc.v1.IListBatchesRequest, - protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IBatch>, - callback?: PaginationCallback< - protos.google.cloud.dataproc.v1.IListBatchesRequest, - protos.google.cloud.dataproc.v1.IListBatchesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IBatch>): - Promise<[ - protos.google.cloud.dataproc.v1.IBatch[], - protos.google.cloud.dataproc.v1.IListBatchesRequest|null, - protos.google.cloud.dataproc.v1.IListBatchesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.listBatches(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of batches. - * @param {number} [request.pageSize] - * Optional. The maximum number of batches to return in each response. - * The service may return fewer than this value. - * The default page size is 20; the maximum page size is 1000. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous `ListBatches` call. - * Provide this token to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter for the batches to return in the response. - * - * A filter is a logical expression constraining the values of various fields - * in each batch resource. Filters are case sensitive, and may contain - * multiple clauses combined with logical operators (AND/OR). - * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. - * - * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` - * filters for batches in state RUNNING that were created before 2023-01-01 - * - * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed - * description of the filter syntax and a list of supported comparisons. - * @param {string} [request.orderBy] - * Optional. Field(s) on which to sort the list of batches. - * - * Currently the only supported sort orders are unspecified (empty) and - * `create_time desc` to sort by most recently created batches first. - * - * See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Batch|Batch} 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 `listBatchesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBatchesStream( - request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, - 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['listBatches']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBatches.createStream( - this.innerApiCalls.listBatches as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBatches`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of batches. - * @param {number} [request.pageSize] - * Optional. The maximum number of batches to return in each response. - * The service may return fewer than this value. - * The default page size is 20; the maximum page size is 1000. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous `ListBatches` call. - * Provide this token to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter for the batches to return in the response. - * - * A filter is a logical expression constraining the values of various fields - * in each batch resource. Filters are case sensitive, and may contain - * multiple clauses combined with logical operators (AND/OR). - * Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`. - * - * e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"` - * filters for batches in state RUNNING that were created before 2023-01-01 - * - * See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed - * description of the filter syntax and a list of supported comparisons. - * @param {string} [request.orderBy] - * Optional. Field(s) on which to sort the list of batches. - * - * Currently the only supported sort orders are unspecified (empty) and - * `create_time desc` to sort by most recently created batches first. - * - * See https://google.aip.dev/132#ordering for more details. - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.dataproc.v1.Batch|Batch}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/batch_controller.list_batches.js - * region_tag:dataproc_v1_generated_BatchController_ListBatches_async - */ - listBatchesAsync( - request?: protos.google.cloud.dataproc.v1.IListBatchesRequest, - 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['listBatches']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBatches.asyncIterate( - this.innerApiCalls['listBatches'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * 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 nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * 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 projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * 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.batchControllerStub && !this._terminated) { - return this.batchControllerStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json deleted file mode 100644 index a451087cbb21..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_client_config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.BatchController": { - "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": { - "CreateBatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBatches": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/batch_controller_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts deleted file mode 100644 index 38ac8b1bf28d..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client.ts +++ /dev/null @@ -1,2157 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/cluster_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cluster_controller_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The ClusterControllerService provides methods to manage clusters - * of Compute Engine instances. - * @class - * @memberof v1 - */ -export class ClusterControllerClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - clusterControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ClusterControllerClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 ClusterControllerClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ClusterControllerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters') - }; - - 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) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createClusterResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; - const createClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - const updateClusterResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; - const updateClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - const stopClusterResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; - const stopClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - const startClusterResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Cluster') as gax.protobuf.Type; - const startClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - const deleteClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - const diagnoseClusterResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.DiagnoseClusterResults') as gax.protobuf.Type; - const diagnoseClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.ClusterOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createClusterResponse.decode.bind(createClusterResponse), - createClusterMetadata.decode.bind(createClusterMetadata)), - updateCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateClusterResponse.decode.bind(updateClusterResponse), - updateClusterMetadata.decode.bind(updateClusterMetadata)), - stopCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopClusterResponse.decode.bind(stopClusterResponse), - stopClusterMetadata.decode.bind(stopClusterMetadata)), - startCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startClusterResponse.decode.bind(startClusterResponse), - startClusterMetadata.decode.bind(startClusterMetadata)), - deleteCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteClusterResponse.decode.bind(deleteClusterResponse), - deleteClusterMetadata.decode.bind(deleteClusterMetadata)), - diagnoseCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - diagnoseClusterResponse.decode.bind(diagnoseClusterResponse), - diagnoseClusterMetadata.decode.bind(diagnoseClusterMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.ClusterController', 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.clusterControllerStub) { - return this.clusterControllerStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.ClusterController. - this.clusterControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.ClusterController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.ClusterController, - 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 clusterControllerStubMethods = - ['createCluster', 'updateCluster', 'stopCluster', 'startCluster', 'deleteCluster', 'getCluster', 'listClusters', 'diagnoseCluster']; - for (const methodName of clusterControllerStubMethods) { - const callPromise = this.clusterControllerStub.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.clusterControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 resource representation for a cluster in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster 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 {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.get_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_GetCluster_async - */ - getCluster( - request?: protos.google.cloud.dataproc.v1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|undefined, {}|undefined - ]>; - getCluster( - request: protos.google.cloud.dataproc.v1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request: protos.google.cloud.dataproc.v1.IGetClusterRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request?: protos.google.cloud.dataproc.v1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.ICluster, - protos.google.cloud.dataproc.v1.IGetClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.getCluster(request, options, callback); - } - -/** - * Creates a cluster in a project. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {google.cloud.dataproc.v1.Cluster} request.cluster - * Required. The cluster to create. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server receives - * two - * [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {google.cloud.dataproc.v1.FailureAction} [request.actionOnFailedPrimaryWorkers] - * Optional. Failure action when primary worker creation fails. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.create_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_CreateCluster_async - */ - createCluster( - request?: protos.google.cloud.dataproc.v1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCluster( - request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request: protos.google.cloud.dataproc.v1.ICreateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request?: protos.google.cloud.dataproc.v1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - this.initialize(); - return this.innerApiCalls.createCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.create_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_CreateCluster_async - */ - async checkCreateClusterProgress(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.createCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a cluster in a project. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * The cluster must be in a - * {@link protos.google.cloud.dataproc.v1.ClusterStatus.State|`RUNNING`} state or an error - * is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project the - * cluster belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster name. - * @param {google.cloud.dataproc.v1.Cluster} request.cluster - * Required. The changes to the cluster. - * @param {google.protobuf.Duration} [request.gracefulDecommissionTimeout] - * Optional. Timeout for graceful YARN decommissioning. Graceful - * decommissioning allows removing nodes from the cluster without - * interrupting jobs in progress. Timeout specifies how long to wait for jobs - * in progress to finish before forcefully removing nodes (and potentially - * interrupting jobs). Default timeout is 0 (for forceful decommission), and - * the maximum allowed timeout is 1 day. (see JSON representation of - * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - * - * Only supported on Dataproc image versions 1.2 and higher. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Specifies the path, relative to `Cluster`, of - * the field to update. For example, to change the number of workers - * in a cluster to 5, the `update_mask` parameter would be - * specified as `config.worker_config.num_instances`, - * and the `PATCH` request body would specify the new value, as follows: - * - * { - * "config":{ - * "workerConfig":{ - * "numInstances":"5" - * } - * } - * } - * Similarly, to change the number of preemptible workers in a cluster to 5, - * the `update_mask` parameter would be - * `config.secondary_worker_config.num_instances`, and the `PATCH` request - * body would be set as follows: - * - * { - * "config":{ - * "secondaryWorkerConfig":{ - * "numInstances":"5" - * } - * } - * } - * Note: Currently, only the following fields can be updated: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
MaskPurpose
labelsUpdate labels
config.worker_config.num_instancesResize primary worker group
config.secondary_worker_config.num_instancesResize secondary worker group
config.autoscaling_config.policy_uriUse, stop using, or - * change autoscaling policies
- * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server - * receives two - * [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.update_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_UpdateCluster_async - */ - updateCluster( - request?: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCluster( - request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request?: protos.google.cloud.dataproc.v1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.update_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_UpdateCluster_async - */ - async checkUpdateClusterProgress(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.updateCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops a cluster in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project the - * cluster belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster name. - * @param {string} [request.clusterUuid] - * Optional. Specifying the `cluster_uuid` means the RPC will fail - * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server - * receives two - * [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * Recommendation: Set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.stop_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_StopCluster_async - */ - stopCluster( - request?: protos.google.cloud.dataproc.v1.IStopClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopCluster( - request: protos.google.cloud.dataproc.v1.IStopClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopCluster( - request: protos.google.cloud.dataproc.v1.IStopClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopCluster( - request?: protos.google.cloud.dataproc.v1.IStopClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.stop_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_StopCluster_async - */ - async checkStopClusterProgress(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.stopCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a cluster in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project the - * cluster belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster name. - * @param {string} [request.clusterUuid] - * Optional. Specifying the `cluster_uuid` means the RPC will fail - * (with error NOT_FOUND) if a cluster with the specified UUID does not exist. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server - * receives two - * [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * Recommendation: Set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.start_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_StartCluster_async - */ - startCluster( - request?: protos.google.cloud.dataproc.v1.IStartClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startCluster( - request: protos.google.cloud.dataproc.v1.IStartClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startCluster( - request: protos.google.cloud.dataproc.v1.IStartClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startCluster( - request?: protos.google.cloud.dataproc.v1.IStartClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.startCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.start_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_StartCluster_async - */ - async checkStartClusterProgress(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.startCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a cluster in a project. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster name. - * @param {string} [request.clusterUuid] - * Optional. Specifying the `cluster_uuid` means the RPC should fail - * (with error NOT_FOUND) if cluster with specified UUID does not exist. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server - * receives two - * [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.delete_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_DeleteCluster_async - */ - deleteCluster( - request?: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteCluster( - request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request?: protos.google.cloud.dataproc.v1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.delete_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_DeleteCluster_async - */ - async checkDeleteClusterProgress(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.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets cluster diagnostic information. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). - * After the operation completes, - * {@link protos.google.longrunning.Operation.response|Operation.response} - * contains - * [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.clusterName - * Required. The cluster name. - * @param {string} [request.tarballGcsDir] - * Optional. The output Cloud Storage directory for the diagnostic - * tarball. If not specified, a task-specific directory in the cluster's - * staging bucket will be used. - * @param {google.type.Interval} [request.diagnosisInterval] - * Optional. Time interval in which diagnosis should be carried out on the - * cluster. - * @param {string[]} [request.jobs] - * Optional. Specifies a list of jobs on which diagnosis is to be performed. - * Format: projects/{project}/regions/{region}/jobs/{job} - * @param {string[]} [request.yarnApplicationIds] - * Optional. Specifies a list of yarn applications on which diagnosis is to be - * performed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.diagnose_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_DiagnoseCluster_async - */ - diagnoseCluster( - request?: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - diagnoseCluster( - request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - diagnoseCluster( - request: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - diagnoseCluster( - request?: protos.google.cloud.dataproc.v1.IDiagnoseClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'cluster_name': request.clusterName ?? '', - }); - this.initialize(); - return this.innerApiCalls.diagnoseCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `diagnoseCluster()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.diagnose_cluster.js - * region_tag:dataproc_v1_generated_ClusterController_DiagnoseCluster_async - */ - async checkDiagnoseClusterProgress(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.diagnoseCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all regions/{region}/clusters in a project alphabetically. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} [request.filter] - * Optional. A filter constraining the clusters to list. Filters are - * case-sensitive and have the following syntax: - * - * field = value [AND [field = value]] ... - * - * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, - * and `[KEY]` is a label key. **value** can be `*` to match all values. - * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, - * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` - * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` - * contains the `DELETING` and `ERROR` states. - * `clusterName` is the name of the cluster provided at creation time. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND clusterName = mycluster - * AND labels.env = staging AND labels.starred = * - * @param {number} [request.pageSize] - * Optional. The standard List page size. - * @param {string} [request.pageToken] - * Optional. 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 {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. - * 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 `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listClusters( - request?: protos.google.cloud.dataproc.v1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.ICluster[], - protos.google.cloud.dataproc.v1.IListClustersRequest|null, - protos.google.cloud.dataproc.v1.IListClustersResponse - ]>; - listClusters( - request: protos.google.cloud.dataproc.v1.IListClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListClustersRequest, - protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, - protos.google.cloud.dataproc.v1.ICluster>): void; - listClusters( - request: protos.google.cloud.dataproc.v1.IListClustersRequest, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListClustersRequest, - protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, - protos.google.cloud.dataproc.v1.ICluster>): void; - listClusters( - request?: protos.google.cloud.dataproc.v1.IListClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dataproc.v1.IListClustersRequest, - protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, - protos.google.cloud.dataproc.v1.ICluster>, - callback?: PaginationCallback< - protos.google.cloud.dataproc.v1.IListClustersRequest, - protos.google.cloud.dataproc.v1.IListClustersResponse|null|undefined, - protos.google.cloud.dataproc.v1.ICluster>): - Promise<[ - protos.google.cloud.dataproc.v1.ICluster[], - protos.google.cloud.dataproc.v1.IListClustersRequest|null, - protos.google.cloud.dataproc.v1.IListClustersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - this.initialize(); - return this.innerApiCalls.listClusters(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.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} [request.filter] - * Optional. A filter constraining the clusters to list. Filters are - * case-sensitive and have the following syntax: - * - * field = value [AND [field = value]] ... - * - * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, - * and `[KEY]` is a label key. **value** can be `*` to match all values. - * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, - * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` - * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` - * contains the `DELETING` and `ERROR` states. - * `clusterName` is the name of the cluster provided at creation time. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND clusterName = mycluster - * AND labels.env = staging AND labels.starred = * - * @param {number} [request.pageSize] - * Optional. The standard List page size. - * @param {string} [request.pageToken] - * Optional. 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 {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Cluster|Cluster} 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 `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listClustersStream( - request?: protos.google.cloud.dataproc.v1.IListClustersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['listClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listClusters.createStream( - this.innerApiCalls.listClusters as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listClusters`, 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.projectId - * Required. The ID of the Google Cloud Platform project that the cluster - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} [request.filter] - * Optional. A filter constraining the clusters to list. Filters are - * case-sensitive and have the following syntax: - * - * field = value [AND [field = value]] ... - * - * where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`, - * and `[KEY]` is a label key. **value** can be `*` to match all values. - * `status.state` can be one of the following: `ACTIVE`, `INACTIVE`, - * `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE` - * contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE` - * contains the `DELETING` and `ERROR` states. - * `clusterName` is the name of the cluster provided at creation time. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND clusterName = mycluster - * AND labels.env = staging AND labels.starred = * - * @param {number} [request.pageSize] - * Optional. The standard List page size. - * @param {string} [request.pageToken] - * Optional. 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.dataproc.v1.Cluster|Cluster}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/cluster_controller.list_clusters.js - * region_tag:dataproc_v1_generated_ClusterController_ListClusters_async - */ - listClustersAsync( - request?: protos.google.cloud.dataproc.v1.IListClustersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['listClusters']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listClusters.asyncIterate( - this.innerApiCalls['listClusters'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * Return a fully-qualified nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * Return a fully-qualified projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.clusterControllerStub && !this._terminated) { - return this.clusterControllerStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json deleted file mode 100644 index 6f5f5f3dd1d9..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_client_config.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.ClusterController": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "CreateCluster": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateCluster": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "StopCluster": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartCluster": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteCluster": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetCluster": { - "timeout_millis": 300000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListClusters": { - "timeout_millis": 300000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DiagnoseCluster": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/cluster_controller_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 36b4ef4bf5d7..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,453 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.dataproc.v1", - "libraryPackage": "@google-cloud/dataproc", - "services": { - "AutoscalingPolicyService": { - "clients": { - "grpc": { - "libraryClient": "AutoscalingPolicyServiceClient", - "rpcs": { - "CreateAutoscalingPolicy": { - "methods": [ - "createAutoscalingPolicy" - ] - }, - "UpdateAutoscalingPolicy": { - "methods": [ - "updateAutoscalingPolicy" - ] - }, - "GetAutoscalingPolicy": { - "methods": [ - "getAutoscalingPolicy" - ] - }, - "DeleteAutoscalingPolicy": { - "methods": [ - "deleteAutoscalingPolicy" - ] - }, - "ListAutoscalingPolicies": { - "methods": [ - "listAutoscalingPolicies", - "listAutoscalingPoliciesStream", - "listAutoscalingPoliciesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AutoscalingPolicyServiceClient", - "rpcs": { - "CreateAutoscalingPolicy": { - "methods": [ - "createAutoscalingPolicy" - ] - }, - "UpdateAutoscalingPolicy": { - "methods": [ - "updateAutoscalingPolicy" - ] - }, - "GetAutoscalingPolicy": { - "methods": [ - "getAutoscalingPolicy" - ] - }, - "DeleteAutoscalingPolicy": { - "methods": [ - "deleteAutoscalingPolicy" - ] - }, - "ListAutoscalingPolicies": { - "methods": [ - "listAutoscalingPolicies", - "listAutoscalingPoliciesStream", - "listAutoscalingPoliciesAsync" - ] - } - } - } - } - }, - "BatchController": { - "clients": { - "grpc": { - "libraryClient": "BatchControllerClient", - "rpcs": { - "GetBatch": { - "methods": [ - "getBatch" - ] - }, - "DeleteBatch": { - "methods": [ - "deleteBatch" - ] - }, - "CreateBatch": { - "methods": [ - "createBatch" - ] - }, - "ListBatches": { - "methods": [ - "listBatches", - "listBatchesStream", - "listBatchesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BatchControllerClient", - "rpcs": { - "GetBatch": { - "methods": [ - "getBatch" - ] - }, - "DeleteBatch": { - "methods": [ - "deleteBatch" - ] - }, - "CreateBatch": { - "methods": [ - "createBatch" - ] - }, - "ListBatches": { - "methods": [ - "listBatches", - "listBatchesStream", - "listBatchesAsync" - ] - } - } - } - } - }, - "ClusterController": { - "clients": { - "grpc": { - "libraryClient": "ClusterControllerClient", - "rpcs": { - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "StopCluster": { - "methods": [ - "stopCluster" - ] - }, - "StartCluster": { - "methods": [ - "startCluster" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "DiagnoseCluster": { - "methods": [ - "diagnoseCluster" - ] - }, - "ListClusters": { - "methods": [ - "listClusters", - "listClustersStream", - "listClustersAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ClusterControllerClient", - "rpcs": { - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "StopCluster": { - "methods": [ - "stopCluster" - ] - }, - "StartCluster": { - "methods": [ - "startCluster" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "DiagnoseCluster": { - "methods": [ - "diagnoseCluster" - ] - }, - "ListClusters": { - "methods": [ - "listClusters", - "listClustersStream", - "listClustersAsync" - ] - } - } - } - } - }, - "JobController": { - "clients": { - "grpc": { - "libraryClient": "JobControllerClient", - "rpcs": { - "SubmitJob": { - "methods": [ - "submitJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "CancelJob": { - "methods": [ - "cancelJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "SubmitJobAsOperation": { - "methods": [ - "submitJobAsOperation" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "JobControllerClient", - "rpcs": { - "SubmitJob": { - "methods": [ - "submitJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "CancelJob": { - "methods": [ - "cancelJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "SubmitJobAsOperation": { - "methods": [ - "submitJobAsOperation" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - } - } - }, - "NodeGroupController": { - "clients": { - "grpc": { - "libraryClient": "NodeGroupControllerClient", - "rpcs": { - "GetNodeGroup": { - "methods": [ - "getNodeGroup" - ] - }, - "CreateNodeGroup": { - "methods": [ - "createNodeGroup" - ] - }, - "ResizeNodeGroup": { - "methods": [ - "resizeNodeGroup" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "NodeGroupControllerClient", - "rpcs": { - "GetNodeGroup": { - "methods": [ - "getNodeGroup" - ] - }, - "CreateNodeGroup": { - "methods": [ - "createNodeGroup" - ] - }, - "ResizeNodeGroup": { - "methods": [ - "resizeNodeGroup" - ] - } - } - } - } - }, - "WorkflowTemplateService": { - "clients": { - "grpc": { - "libraryClient": "WorkflowTemplateServiceClient", - "rpcs": { - "CreateWorkflowTemplate": { - "methods": [ - "createWorkflowTemplate" - ] - }, - "GetWorkflowTemplate": { - "methods": [ - "getWorkflowTemplate" - ] - }, - "UpdateWorkflowTemplate": { - "methods": [ - "updateWorkflowTemplate" - ] - }, - "DeleteWorkflowTemplate": { - "methods": [ - "deleteWorkflowTemplate" - ] - }, - "InstantiateWorkflowTemplate": { - "methods": [ - "instantiateWorkflowTemplate" - ] - }, - "InstantiateInlineWorkflowTemplate": { - "methods": [ - "instantiateInlineWorkflowTemplate" - ] - }, - "ListWorkflowTemplates": { - "methods": [ - "listWorkflowTemplates", - "listWorkflowTemplatesStream", - "listWorkflowTemplatesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkflowTemplateServiceClient", - "rpcs": { - "CreateWorkflowTemplate": { - "methods": [ - "createWorkflowTemplate" - ] - }, - "GetWorkflowTemplate": { - "methods": [ - "getWorkflowTemplate" - ] - }, - "UpdateWorkflowTemplate": { - "methods": [ - "updateWorkflowTemplate" - ] - }, - "DeleteWorkflowTemplate": { - "methods": [ - "deleteWorkflowTemplate" - ] - }, - "InstantiateWorkflowTemplate": { - "methods": [ - "instantiateWorkflowTemplate" - ] - }, - "InstantiateInlineWorkflowTemplate": { - "methods": [ - "instantiateInlineWorkflowTemplate" - ] - }, - "ListWorkflowTemplates": { - "methods": [ - "listWorkflowTemplates", - "listWorkflowTemplatesStream", - "listWorkflowTemplatesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts deleted file mode 100644 index 2d24fc7037e3..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {AutoscalingPolicyServiceClient} from './autoscaling_policy_service_client'; -export {BatchControllerClient} from './batch_controller_client'; -export {ClusterControllerClient} from './cluster_controller_client'; -export {JobControllerClient} from './job_controller_client'; -export {NodeGroupControllerClient} from './node_group_controller_client'; -export {WorkflowTemplateServiceClient} from './workflow_template_service_client'; diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts deleted file mode 100644 index fd72ca4526d3..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client.ts +++ /dev/null @@ -1,1775 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/job_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './job_controller_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The JobController provides methods to manage jobs. - * @class - * @memberof v1 - */ -export class JobControllerClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - jobControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of JobControllerClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 JobControllerClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof JobControllerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - }; - - // 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 = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - 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) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const submitJobAsOperationResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.Job') as gax.protobuf.Type; - const submitJobAsOperationMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.JobMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - submitJobAsOperation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - submitJobAsOperationResponse.decode.bind(submitJobAsOperationResponse), - submitJobAsOperationMetadata.decode.bind(submitJobAsOperationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.JobController', 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.jobControllerStub) { - return this.jobControllerStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.JobController. - this.jobControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.JobController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.JobController, - 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 jobControllerStubMethods = - ['submitJob', 'submitJobAsOperation', 'getJob', 'listJobs', 'updateJob', 'cancelJob', 'deleteJob']; - for (const methodName of jobControllerStubMethods) { - const callPromise = this.jobControllerStub.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.jobControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 -- - // ------------------- -/** - * Submits a job to a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {google.cloud.dataproc.v1.Job} request.job - * Required. The job resource. - * @param {string} [request.requestId] - * Optional. A unique id used to identify the request. If the server - * receives two - * [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.cloud.dataproc.v1.Job|Job} created and stored in the backend - * is returned. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The id must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.submit_job.js - * region_tag:dataproc_v1_generated_JobController_SubmitJob_async - */ - submitJob( - request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|undefined, {}|undefined - ]>; - submitJob( - request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, - {}|null|undefined>): void; - submitJob( - request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, - {}|null|undefined>): void; - submitJob( - request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ISubmitJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - this.initialize(); - return this.innerApiCalls.submitJob(request, options, callback); - } -/** - * Gets the resource representation for a job in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.jobId - * Required. The job ID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.get_job.js - * region_tag:dataproc_v1_generated_JobController_GetJob_async - */ - getJob( - request?: protos.google.cloud.dataproc.v1.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.dataproc.v1.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.dataproc.v1.IGetJobRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request?: protos.google.cloud.dataproc.v1.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.getJob(request, options, callback); - } -/** - * Updates a job in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.jobId - * Required. The job ID. - * @param {google.cloud.dataproc.v1.Job} request.job - * Required. The changes to the job. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Specifies the path, relative to Job, of - * the field to update. For example, to update the labels of a Job the - * update_mask parameter would be specified as - * labels, and the `PATCH` request body would specify the new - * value. Note: Currently, labels is the only - * field that can be 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 {@link protos.google.cloud.dataproc.v1.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.update_job.js - * region_tag:dataproc_v1_generated_JobController_UpdateJob_async - */ - updateJob( - request?: protos.google.cloud.dataproc.v1.IUpdateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|undefined, {}|undefined - ]>; - updateJob( - request: protos.google.cloud.dataproc.v1.IUpdateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request: protos.google.cloud.dataproc.v1.IUpdateJobRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request?: protos.google.cloud.dataproc.v1.IUpdateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.IUpdateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateJob(request, options, callback); - } -/** - * Starts a job cancellation request. To access the job resource - * after cancellation, call - * [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) - * or - * [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.jobId - * Required. The job ID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.cancel_job.js - * region_tag:dataproc_v1_generated_JobController_CancelJob_async - */ - cancelJob( - request?: protos.google.cloud.dataproc.v1.ICancelJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|undefined, {}|undefined - ]>; - cancelJob( - request: protos.google.cloud.dataproc.v1.ICancelJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request: protos.google.cloud.dataproc.v1.ICancelJobRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request?: protos.google.cloud.dataproc.v1.ICancelJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IJob, - protos.google.cloud.dataproc.v1.ICancelJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelJob(request, options, callback); - } -/** - * Deletes the job from the project. If the job is active, the delete fails, - * and the response returns `FAILED_PRECONDITION`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {string} request.jobId - * Required. The job ID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.delete_job.js - * region_tag:dataproc_v1_generated_JobController_DeleteJob_async - */ - deleteJob( - request?: protos.google.cloud.dataproc.v1.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.dataproc.v1.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.dataproc.v1.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request?: protos.google.cloud.dataproc.v1.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - 'job_id': request.jobId ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteJob(request, options, callback); - } - -/** - * Submits job to a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {google.cloud.dataproc.v1.Job} request.job - * Required. The job resource. - * @param {string} [request.requestId] - * Optional. A unique id used to identify the request. If the server - * receives two - * [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s - * with the same id, then the second request will be ignored and the - * first {@link protos.google.cloud.dataproc.v1.Job|Job} created and stored in the backend - * is returned. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The id must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.submit_job_as_operation.js - * region_tag:dataproc_v1_generated_JobController_SubmitJobAsOperation_async - */ - submitJobAsOperation( - request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - submitJobAsOperation( - request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - submitJobAsOperation( - request: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - submitJobAsOperation( - request?: protos.google.cloud.dataproc.v1.ISubmitJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - this.initialize(); - return this.innerApiCalls.submitJobAsOperation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `submitJobAsOperation()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.submit_job_as_operation.js - * region_tag:dataproc_v1_generated_JobController_SubmitJobAsOperation_async - */ - async checkSubmitJobAsOperationProgress(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.submitJobAsOperation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists regions/{region}/jobs in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {number} [request.pageSize] - * Optional. The number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {string} [request.clusterName] - * Optional. If set, the returned jobs list includes only jobs that were - * submitted to the named cluster. - * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] - * Optional. Specifies enumerated categories of jobs to list. - * (default = match ALL jobs). - * - * If `filter` is provided, `jobStateMatcher` will be ignored. - * @param {string} [request.filter] - * Optional. A filter constraining the jobs to list. Filters are - * case-sensitive and have the following syntax: - * - * [field = value] AND [field [= value]] ... - * - * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label - * key. **value** can be `*` to match all values. - * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND labels.env = staging AND labels.starred = * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.Job|Job}. - * 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 `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobs( - request?: protos.google.cloud.dataproc.v1.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IJob[], - protos.google.cloud.dataproc.v1.IListJobsRequest|null, - protos.google.cloud.dataproc.v1.IListJobsResponse - ]>; - listJobs( - request: protos.google.cloud.dataproc.v1.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListJobsRequest, - protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, - protos.google.cloud.dataproc.v1.IJob>): void; - listJobs( - request: protos.google.cloud.dataproc.v1.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListJobsRequest, - protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, - protos.google.cloud.dataproc.v1.IJob>): void; - listJobs( - request?: protos.google.cloud.dataproc.v1.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dataproc.v1.IListJobsRequest, - protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, - protos.google.cloud.dataproc.v1.IJob>, - callback?: PaginationCallback< - protos.google.cloud.dataproc.v1.IListJobsRequest, - protos.google.cloud.dataproc.v1.IListJobsResponse|null|undefined, - protos.google.cloud.dataproc.v1.IJob>): - Promise<[ - protos.google.cloud.dataproc.v1.IJob[], - protos.google.cloud.dataproc.v1.IListJobsRequest|null, - protos.google.cloud.dataproc.v1.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - this.initialize(); - return this.innerApiCalls.listJobs(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.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {number} [request.pageSize] - * Optional. The number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {string} [request.clusterName] - * Optional. If set, the returned jobs list includes only jobs that were - * submitted to the named cluster. - * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] - * Optional. Specifies enumerated categories of jobs to list. - * (default = match ALL jobs). - * - * If `filter` is provided, `jobStateMatcher` will be ignored. - * @param {string} [request.filter] - * Optional. A filter constraining the jobs to list. Filters are - * case-sensitive and have the following syntax: - * - * [field = value] AND [field [= value]] ... - * - * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label - * key. **value** can be `*` to match all values. - * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND labels.env = staging AND labels.starred = * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.Job|Job} 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 `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listJobsStream( - request?: protos.google.cloud.dataproc.v1.IListJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, 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.projectId - * Required. The ID of the Google Cloud Platform project that the job - * belongs to. - * @param {string} request.region - * Required. The Dataproc region in which to handle the request. - * @param {number} [request.pageSize] - * Optional. The number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {string} [request.clusterName] - * Optional. If set, the returned jobs list includes only jobs that were - * submitted to the named cluster. - * @param {google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher} [request.jobStateMatcher] - * Optional. Specifies enumerated categories of jobs to list. - * (default = match ALL jobs). - * - * If `filter` is provided, `jobStateMatcher` will be ignored. - * @param {string} [request.filter] - * Optional. A filter constraining the jobs to list. Filters are - * case-sensitive and have the following syntax: - * - * [field = value] AND [field [= value]] ... - * - * where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label - * key. **value** can be `*` to match all values. - * `status.state` can be either `ACTIVE` or `NON_ACTIVE`. - * Only the logical `AND` operator is supported; space-separated items are - * treated as having an implicit `AND` operator. - * - * Example filter: - * - * status.state = ACTIVE AND labels.env = staging AND labels.starred = * - * @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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.dataproc.v1.Job|Job}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/job_controller.list_jobs.js - * region_tag:dataproc_v1_generated_JobController_ListJobs_async - */ - listJobsAsync( - request?: protos.google.cloud.dataproc.v1.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * Return a fully-qualified nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * Return a fully-qualified projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * 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.jobControllerStub && !this._terminated) { - return this.jobControllerStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json deleted file mode 100644 index 5d75711034e7..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_client_config.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.JobController": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "SubmitJob": { - "timeout_millis": 900000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SubmitJobAsOperation": { - "timeout_millis": 900000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetJob": { - "timeout_millis": 900000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListJobs": { - "timeout_millis": 900000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "UpdateJob": { - "timeout_millis": 900000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CancelJob": { - "timeout_millis": 900000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteJob": { - "timeout_millis": 900000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/job_controller_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts deleted file mode 100644 index e9f7c61bd34c..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client.ts +++ /dev/null @@ -1,1428 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/node_group_controller_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './node_group_controller_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The `NodeGroupControllerService` provides methods to manage node groups - * of Compute Engine managed instances. - * @class - * @memberof v1 - */ -export class NodeGroupControllerClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - nodeGroupControllerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of NodeGroupControllerClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 NodeGroupControllerClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NodeGroupControllerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - clusterRegionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - regionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}' - ), - }; - - 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) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createNodeGroupResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.NodeGroup') as gax.protobuf.Type; - const createNodeGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.NodeGroupOperationMetadata') as gax.protobuf.Type; - const resizeNodeGroupResponse = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.NodeGroup') as gax.protobuf.Type; - const resizeNodeGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.NodeGroupOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createNodeGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createNodeGroupResponse.decode.bind(createNodeGroupResponse), - createNodeGroupMetadata.decode.bind(createNodeGroupMetadata)), - resizeNodeGroup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - resizeNodeGroupResponse.decode.bind(resizeNodeGroupResponse), - resizeNodeGroupMetadata.decode.bind(resizeNodeGroupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.NodeGroupController', 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.nodeGroupControllerStub) { - return this.nodeGroupControllerStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.NodeGroupController. - this.nodeGroupControllerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.NodeGroupController') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.NodeGroupController, - 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 nodeGroupControllerStubMethods = - ['createNodeGroup', 'resizeNodeGroup', 'getNodeGroup']; - for (const methodName of nodeGroupControllerStubMethods) { - const callPromise = this.nodeGroupControllerStub.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.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.nodeGroupControllerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 resource representation for a node group in a - * cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the node group to retrieve. - * Format: - * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.NodeGroup|NodeGroup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/node_group_controller.get_node_group.js - * region_tag:dataproc_v1_generated_NodeGroupController_GetNodeGroup_async - */ - getNodeGroup( - request?: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|undefined, {}|undefined - ]>; - getNodeGroup( - request: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, - {}|null|undefined>): void; - getNodeGroup( - request: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, - {}|null|undefined>): void; - getNodeGroup( - request?: protos.google.cloud.dataproc.v1.IGetNodeGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.INodeGroup, - protos.google.cloud.dataproc.v1.IGetNodeGroupRequest|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.getNodeGroup(request, options, callback); - } - -/** - * Creates a node group in a cluster. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} is - * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this node group will be created. - * Format: `projects/{project}/regions/{region}/clusters/{cluster}` - * @param {google.cloud.dataproc.v1.NodeGroup} request.nodeGroup - * Required. The node group to create. - * @param {string} [request.nodeGroupId] - * Optional. An optional node group ID. Generated if not specified. - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). Cannot begin or end with underscore - * or hyphen. Must consist of from 3 to 33 characters. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server receives - * two - * [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests) - * with the same ID, the second request is ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * Recommendation: Set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/node_group_controller.create_node_group.js - * region_tag:dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async - */ - createNodeGroup( - request?: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createNodeGroup( - request: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNodeGroup( - request: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNodeGroup( - request?: protos.google.cloud.dataproc.v1.ICreateNodeGroupRequest, - 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.createNodeGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createNodeGroup()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/node_group_controller.create_node_group.js - * region_tag:dataproc_v1_generated_NodeGroupController_CreateNodeGroup_async - */ - async checkCreateNodeGroupProgress(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.createNodeGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Resizes a node group in a cluster. The returned - * {@link protos.google.longrunning.Operation.metadata|Operation.metadata} is - * [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the node group to resize. - * Format: - * `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}` - * @param {number} request.size - * Required. The number of running instances for the node group to maintain. - * The group adds or removes instances to maintain the number of instances - * specified by this parameter. - * @param {string} [request.requestId] - * Optional. A unique ID used to identify the request. If the server receives - * two - * [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) - * with the same ID, the second request is ignored and the - * first {@link protos.google.longrunning.Operation|google.longrunning.Operation} created - * and stored in the backend is returned. - * - * Recommendation: Set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The ID must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {google.protobuf.Duration} [request.gracefulDecommissionTimeout] - * Optional. Timeout for graceful YARN decommissioning. [Graceful - * decommissioning] - * (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) - * allows the removal of nodes from the Compute Engine node group - * without interrupting jobs in progress. This timeout specifies how long to - * wait for jobs in progress to finish before forcefully removing nodes (and - * potentially interrupting jobs). Default timeout is 0 (for forceful - * decommission), and the maximum allowed timeout is 1 day. (see JSON - * representation of - * [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)). - * - * Only supported on Dataproc image versions 1.2 and higher. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/node_group_controller.resize_node_group.js - * region_tag:dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async - */ - resizeNodeGroup( - request?: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - resizeNodeGroup( - request: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resizeNodeGroup( - request: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - resizeNodeGroup( - request?: protos.google.cloud.dataproc.v1.IResizeNodeGroupRequest, - 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.resizeNodeGroup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `resizeNodeGroup()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/node_group_controller.resize_node_group.js - * region_tag:dataproc_v1_generated_NodeGroupController_ResizeNodeGroup_async - */ - async checkResizeNodeGroupProgress(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.resizeNodeGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * Return a fully-qualified clusterRegion resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @returns {string} Resource name string. - */ - clusterRegionPath(project:string,region:string,cluster:string) { - return this.pathTemplates.clusterRegionPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - }); - } - - /** - * Parse the project from ClusterRegion resource. - * - * @param {string} clusterRegionName - * A fully-qualified path representing ClusterRegion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromClusterRegionName(clusterRegionName: string) { - return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).project; - } - - /** - * Parse the region from ClusterRegion resource. - * - * @param {string} clusterRegionName - * A fully-qualified path representing ClusterRegion resource. - * @returns {string} A string representing the region. - */ - matchRegionFromClusterRegionName(clusterRegionName: string) { - return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).region; - } - - /** - * Parse the cluster from ClusterRegion resource. - * - * @param {string} clusterRegionName - * A fully-qualified path representing ClusterRegion resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromClusterRegionName(clusterRegionName: string) { - return this.pathTemplates.clusterRegionPathTemplate.match(clusterRegionName).cluster; - } - - /** - * Return a fully-qualified nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * 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 projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified region resource name string. - * - * @param {string} project - * @param {string} region - * @returns {string} Resource name string. - */ - regionPath(project:string,region:string) { - return this.pathTemplates.regionPathTemplate.render({ - project: project, - region: region, - }); - } - - /** - * Parse the project from Region resource. - * - * @param {string} regionName - * A fully-qualified path representing Region resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRegionName(regionName: string) { - return this.pathTemplates.regionPathTemplate.match(regionName).project; - } - - /** - * Parse the region from Region resource. - * - * @param {string} regionName - * A fully-qualified path representing Region resource. - * @returns {string} A string representing the region. - */ - matchRegionFromRegionName(regionName: string) { - return this.pathTemplates.regionPathTemplate.match(regionName).region; - } - - /** - * 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.nodeGroupControllerStub && !this._terminated) { - return this.nodeGroupControllerStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json deleted file mode 100644 index 3e7761ab670f..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_client_config.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.NodeGroupController": { - "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": { - "CreateNodeGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResizeNodeGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNodeGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/node_group_controller_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts deleted file mode 100644 index 03d4d8ac8946..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client.ts +++ /dev/null @@ -1,1871 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos} 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/workflow_template_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workflow_template_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The API interface for managing Workflow Templates in the - * Dataproc API. - * @class - * @memberof v1 - */ -export class WorkflowTemplateServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - workflowTemplateServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkflowTemplateServiceClient. - * - * @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} [options.fallback] - Use HTTP/1.1 REST mode. - * 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 WorkflowTemplateServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WorkflowTemplateServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // 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 { - 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 = { - batchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/batches/{batch}' - ), - nodeGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/autoscalingPolicies/{autoscaling_policy}' - ), - projectLocationWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflowTemplates/{workflow_template}' - ), - projectRegionAutoscalingPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/autoscalingPolicies/{autoscaling_policy}' - ), - projectRegionWorkflowTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/workflowTemplates/{workflow_template}' - ), - regionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}' - ), - }; - - // 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 = { - listWorkflowTemplates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'templates') - }; - - 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) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/regions/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/regions/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/regions/*/operations}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const instantiateWorkflowTemplateResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const instantiateWorkflowTemplateMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.WorkflowMetadata') as gax.protobuf.Type; - const instantiateInlineWorkflowTemplateResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const instantiateInlineWorkflowTemplateMetadata = protoFilesRoot.lookup( - '.google.cloud.dataproc.v1.WorkflowMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - instantiateWorkflowTemplate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - instantiateWorkflowTemplateResponse.decode.bind(instantiateWorkflowTemplateResponse), - instantiateWorkflowTemplateMetadata.decode.bind(instantiateWorkflowTemplateMetadata)), - instantiateInlineWorkflowTemplate: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - instantiateInlineWorkflowTemplateResponse.decode.bind(instantiateInlineWorkflowTemplateResponse), - instantiateInlineWorkflowTemplateMetadata.decode.bind(instantiateInlineWorkflowTemplateMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dataproc.v1.WorkflowTemplateService', 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.workflowTemplateServiceStub) { - return this.workflowTemplateServiceStub; - } - - // Put together the "service stub" for - // google.cloud.dataproc.v1.WorkflowTemplateService. - this.workflowTemplateServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dataproc.v1.WorkflowTemplateService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dataproc.v1.WorkflowTemplateService, - 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 workflowTemplateServiceStubMethods = - ['createWorkflowTemplate', 'getWorkflowTemplate', 'instantiateWorkflowTemplate', 'instantiateInlineWorkflowTemplate', 'updateWorkflowTemplate', 'listWorkflowTemplates', 'deleteWorkflowTemplate']; - for (const methodName of workflowTemplateServiceStubMethods) { - const callPromise = this.workflowTemplateServiceStub.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.workflowTemplateServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'dataproc.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 'dataproc.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 -- - // ------------------- -/** - * Creates new workflow template. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates.create`, the resource name of the - * region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.workflowTemplates.create`, the resource name of - * the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template - * Required. The Dataproc workflow template to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.create_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_CreateWorkflowTemplate_async - */ - createWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|undefined, {}|undefined - ]>; - createWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - createWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - createWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.ICreateWorkflowTemplateRequest|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.createWorkflowTemplate(request, options, callback); - } -/** - * Retrieves the latest workflow template. - * - * Can retrieve previously instantiated template by specifying optional - * version parameter. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates.get`, the resource name of the - * template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * - * * For `projects.locations.workflowTemplates.get`, the resource name of the - * template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - * @param {number} [request.version] - * Optional. The version of workflow template to retrieve. Only previously - * instantiated versions can be retrieved. - * - * If unspecified, retrieves the current version. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.get_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_GetWorkflowTemplate_async - */ - getWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|undefined, {}|undefined - ]>; - getWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - getWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - getWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IGetWorkflowTemplateRequest|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.getWorkflowTemplate(request, options, callback); - } -/** - * Updates (replaces) workflow template. The updated template - * must contain version that matches the current server version. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template - * Required. The updated workflow template. - * - * The `template.version` field must match the current version. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.update_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_UpdateWorkflowTemplate_async - */ - updateWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|undefined, {}|undefined - ]>; - updateWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, - callback: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate, - protos.google.cloud.dataproc.v1.IUpdateWorkflowTemplateRequest|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({ - 'template.name': request.template!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkflowTemplate(request, options, callback); - } -/** - * Deletes a workflow template. It does not cancel in-progress workflows. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates.delete`, the resource name - * of the template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * - * * For `projects.locations.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - * @param {number} [request.version] - * Optional. The version of workflow template to delete. If specified, - * will only delete the template if the current server version matches - * specified version. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.delete_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_DeleteWorkflowTemplate_async - */ - deleteWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|undefined, {}|undefined - ]>; - deleteWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.dataproc.v1.IDeleteWorkflowTemplateRequest|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.deleteWorkflowTemplate(request, options, callback); - } - -/** - * Instantiates a template and begins execution. - * - * The returned Operation can be used to track execution of - * workflow by polling - * {@link protos.google.longrunning.Operations.GetOperation|operations.get}. - * The Operation will complete when entire workflow is finished. - * - * The running workflow can be aborted via - * {@link protos.google.longrunning.Operations.CancelOperation|operations.cancel}. - * This will cause any inflight jobs to be cancelled and workflow-owned - * clusters to be deleted. - * - * The {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). - * Also see [Using - * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). - * - * On successful completion, - * {@link protos.google.longrunning.Operation.response|Operation.response} will be - * {@link protos.google.protobuf.Empty|Empty}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the workflow template, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` - * - * * For `projects.locations.workflowTemplates.instantiate`, the resource name - * of the template has the following format: - * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` - * @param {number} [request.version] - * Optional. The version of workflow template to instantiate. If specified, - * the workflow will be instantiated only if the current version of - * the workflow template has the supplied version. - * - * This option cannot be used to instantiate a previous version of - * workflow template. - * @param {string} [request.requestId] - * Optional. A tag that prevents multiple concurrent workflow - * instances with the same tag from running. This mitigates risk of - * concurrent instances started due to retries. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The tag must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {number[]} [request.parameters] - * Optional. Map from parameter names to values that should be used for those - * parameters. Values may not exceed 1000 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.instantiate_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async - */ - instantiateWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - instantiateWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - instantiateWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - instantiateWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IInstantiateWorkflowTemplateRequest, - 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.instantiateWorkflowTemplate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `instantiateWorkflowTemplate()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.instantiate_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateWorkflowTemplate_async - */ - async checkInstantiateWorkflowTemplateProgress(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.instantiateWorkflowTemplate, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Instantiates a template and begins execution. - * - * This method is equivalent to executing the sequence - * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate|CreateWorkflowTemplate}, - * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate|InstantiateWorkflowTemplate}, - * {@link protos.google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate|DeleteWorkflowTemplate}. - * - * The returned Operation can be used to track execution of - * workflow by polling - * {@link protos.google.longrunning.Operations.GetOperation|operations.get}. - * The Operation will complete when entire workflow is finished. - * - * The running workflow can be aborted via - * {@link protos.google.longrunning.Operations.CancelOperation|operations.cancel}. - * This will cause any inflight jobs to be cancelled and workflow-owned - * clusters to be deleted. - * - * The {@link protos.google.longrunning.Operation.metadata|Operation.metadata} will be - * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). - * Also see [Using - * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). - * - * On successful completion, - * {@link protos.google.longrunning.Operation.response|Operation.response} will be - * {@link protos.google.protobuf.Empty|Empty}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates,instantiateinline`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.workflowTemplates.instantiateinline`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {google.cloud.dataproc.v1.WorkflowTemplate} request.template - * Required. The workflow template to instantiate. - * @param {string} [request.requestId] - * Optional. A tag that prevents multiple concurrent workflow - * instances with the same tag from running. This mitigates risk of - * concurrent instances started due to retries. - * - * It is recommended to always set this value to a - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). - * - * The tag must contain only letters (a-z, A-Z), numbers (0-9), - * underscores (_), and hyphens (-). The maximum length is 40 characters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async - */ - instantiateInlineWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - instantiateInlineWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - instantiateInlineWorkflowTemplate( - request: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - instantiateInlineWorkflowTemplate( - request?: protos.google.cloud.dataproc.v1.IInstantiateInlineWorkflowTemplateRequest, - 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.instantiateInlineWorkflowTemplate(request, options, callback); - } -/** - * Check the status of the long running operation returned by `instantiateInlineWorkflowTemplate()`. - * @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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.instantiate_inline_workflow_template.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_InstantiateInlineWorkflowTemplate_async - */ - async checkInstantiateInlineWorkflowTemplateProgress(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.instantiateInlineWorkflowTemplate, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists workflows that match the specified filter in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates,list`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.workflowTemplates.list`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. - * 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 `listWorkflowTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflowTemplates( - request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate[], - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest|null, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse - ]>; - listWorkflowTemplates( - request: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IWorkflowTemplate>): void; - listWorkflowTemplates( - request: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - callback: PaginationCallback< - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IWorkflowTemplate>): void; - listWorkflowTemplates( - request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IWorkflowTemplate>, - callback?: PaginationCallback< - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse|null|undefined, - protos.google.cloud.dataproc.v1.IWorkflowTemplate>): - Promise<[ - protos.google.cloud.dataproc.v1.IWorkflowTemplate[], - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest|null, - protos.google.cloud.dataproc.v1.IListWorkflowTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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.listWorkflowTemplates(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 resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates,list`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.workflowTemplates.list`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate} 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 `listWorkflowTemplatesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listWorkflowTemplatesStream( - request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - 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['listWorkflowTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflowTemplates.createStream( - this.innerApiCalls.listWorkflowTemplates as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkflowTemplates`, 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 resource name of the region or location, as described - * in https://cloud.google.com/apis/design/resource_names. - * - * * For `projects.regions.workflowTemplates,list`, the resource - * name of the region has the following format: - * `projects/{project_id}/regions/{region}` - * - * * For `projects.locations.workflowTemplates.list`, the - * resource name of the location has the following format: - * `projects/{project_id}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in each response. - * @param {string} [request.pageToken] - * Optional. The page token, returned by a previous call, to request the - * next page of 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 {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.dataproc.v1.WorkflowTemplate|WorkflowTemplate}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workflow_template_service.list_workflow_templates.js - * region_tag:dataproc_v1_generated_WorkflowTemplateService_ListWorkflowTemplates_async - */ - listWorkflowTemplatesAsync( - request?: protos.google.cloud.dataproc.v1.IListWorkflowTemplatesRequest, - 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['listWorkflowTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkflowTemplates.asyncIterate( - this.innerApiCalls['listWorkflowTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified batch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} batch - * @returns {string} Resource name string. - */ - batchPath(project:string,location:string,batch:string) { - return this.pathTemplates.batchPathTemplate.render({ - project: project, - location: location, - batch: batch, - }); - } - - /** - * Parse the project from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).project; - } - - /** - * Parse the location from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).location; - } - - /** - * Parse the batch from Batch resource. - * - * @param {string} batchName - * A fully-qualified path representing Batch resource. - * @returns {string} A string representing the batch. - */ - matchBatchFromBatchName(batchName: string) { - return this.pathTemplates.batchPathTemplate.match(batchName).batch; - } - - /** - * Return a fully-qualified nodeGroup resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} cluster - * @param {string} node_group - * @returns {string} Resource name string. - */ - nodeGroupPath(project:string,region:string,cluster:string,nodeGroup:string) { - return this.pathTemplates.nodeGroupPathTemplate.render({ - project: project, - region: region, - cluster: cluster, - node_group: nodeGroup, - }); - } - - /** - * Parse the project from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).project; - } - - /** - * Parse the region from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the region. - */ - matchRegionFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).region; - } - - /** - * Parse the cluster from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).cluster; - } - - /** - * Parse the node_group from NodeGroup resource. - * - * @param {string} nodeGroupName - * A fully-qualified path representing NodeGroup resource. - * @returns {string} A string representing the node_group. - */ - matchNodeGroupFromNodeGroupName(nodeGroupName: string) { - return this.pathTemplates.nodeGroupPathTemplate.match(nodeGroupName).node_group; - } - - /** - * 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 projectLocationAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectLocationAutoscalingPolicyPath(project:string,location:string,autoscalingPolicy:string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render({ - project: project, - location: location, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).project; - } - - /** - * Parse the location from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).location; - } - - /** - * Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource. - * - * @param {string} projectLocationAutoscalingPolicyName - * A fully-qualified path representing project_location_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName: string) { - return this.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match(projectLocationAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectLocationWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectLocationWorkflowTemplatePath(project:string,location:string,workflowTemplate:string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render({ - project: project, - location: location, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).project; - } - - /** - * Parse the location from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).location; - } - - /** - * Parse the workflow_template from ProjectLocationWorkflowTemplate resource. - * - * @param {string} projectLocationWorkflowTemplateName - * A fully-qualified path representing project_location_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName: string) { - return this.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match(projectLocationWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified projectRegionAutoscalingPolicy resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} autoscaling_policy - * @returns {string} Resource name string. - */ - projectRegionAutoscalingPolicyPath(project:string,region:string,autoscalingPolicy:string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render({ - project: project, - region: region, - autoscaling_policy: autoscalingPolicy, - }); - } - - /** - * Parse the project from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).project; - } - - /** - * Parse the region from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).region; - } - - /** - * Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource. - * - * @param {string} projectRegionAutoscalingPolicyName - * A fully-qualified path representing project_region_autoscaling_policy resource. - * @returns {string} A string representing the autoscaling_policy. - */ - matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName: string) { - return this.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match(projectRegionAutoscalingPolicyName).autoscaling_policy; - } - - /** - * Return a fully-qualified projectRegionWorkflowTemplate resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} workflow_template - * @returns {string} Resource name string. - */ - projectRegionWorkflowTemplatePath(project:string,region:string,workflowTemplate:string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render({ - project: project, - region: region, - workflow_template: workflowTemplate, - }); - } - - /** - * Parse the project from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).project; - } - - /** - * Parse the region from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the region. - */ - matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).region; - } - - /** - * Parse the workflow_template from ProjectRegionWorkflowTemplate resource. - * - * @param {string} projectRegionWorkflowTemplateName - * A fully-qualified path representing project_region_workflow_template resource. - * @returns {string} A string representing the workflow_template. - */ - matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName: string) { - return this.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match(projectRegionWorkflowTemplateName).workflow_template; - } - - /** - * Return a fully-qualified region resource name string. - * - * @param {string} project - * @param {string} region - * @returns {string} Resource name string. - */ - regionPath(project:string,region:string) { - return this.pathTemplates.regionPathTemplate.render({ - project: project, - region: region, - }); - } - - /** - * Parse the project from Region resource. - * - * @param {string} regionName - * A fully-qualified path representing Region resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRegionName(regionName: string) { - return this.pathTemplates.regionPathTemplate.match(regionName).project; - } - - /** - * Parse the region from Region resource. - * - * @param {string} regionName - * A fully-qualified path representing Region resource. - * @returns {string} A string representing the region. - */ - matchRegionFromRegionName(regionName: string) { - return this.pathTemplates.regionPathTemplate.match(regionName).region; - } - - /** - * 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.workflowTemplateServiceStub && !this._terminated) { - return this.workflowTemplateServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json deleted file mode 100644 index 62d3aa9b9a02..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_client_config.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "interfaces": { - "google.cloud.dataproc.v1.WorkflowTemplateService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "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": { - "CreateWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "InstantiateWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "InstantiateInlineWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UpdateWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListWorkflowTemplates": { - "timeout_millis": 600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteWorkflowTemplate": { - "timeout_millis": 600000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json b/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json deleted file mode 100644 index 3bb7ccf055af..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/src/v1/workflow_template_service_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/dataproc/v1/autoscaling_policies.proto", - "../../protos/google/cloud/dataproc/v1/batches.proto", - "../../protos/google/cloud/dataproc/v1/clusters.proto", - "../../protos/google/cloud/dataproc/v1/jobs.proto", - "../../protos/google/cloud/dataproc/v1/node_groups.proto", - "../../protos/google/cloud/dataproc/v1/operations.proto", - "../../protos/google/cloud/dataproc/v1/shared.proto", - "../../protos/google/cloud/dataproc/v1/workflow_templates.proto" -] diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 46bd93df71bc..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const dataproc = require('@google-cloud/dataproc'); - -function main() { - const autoscalingPolicyServiceClient = new dataproc.AutoscalingPolicyServiceClient(); - const batchControllerClient = new dataproc.BatchControllerClient(); - const clusterControllerClient = new dataproc.ClusterControllerClient(); - const jobControllerClient = new dataproc.JobControllerClient(); - const nodeGroupControllerClient = new dataproc.NodeGroupControllerClient(); - const workflowTemplateServiceClient = new dataproc.WorkflowTemplateServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index bcccf7df5fd6..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {AutoscalingPolicyServiceClient, BatchControllerClient, ClusterControllerClient, JobControllerClient, NodeGroupControllerClient, WorkflowTemplateServiceClient} from '@google-cloud/dataproc'; - -// check that the client class type name can be used -function doStuffWithAutoscalingPolicyServiceClient(client: AutoscalingPolicyServiceClient) { - client.close(); -} -function doStuffWithBatchControllerClient(client: BatchControllerClient) { - client.close(); -} -function doStuffWithClusterControllerClient(client: ClusterControllerClient) { - client.close(); -} -function doStuffWithJobControllerClient(client: JobControllerClient) { - client.close(); -} -function doStuffWithNodeGroupControllerClient(client: NodeGroupControllerClient) { - client.close(); -} -function doStuffWithWorkflowTemplateServiceClient(client: WorkflowTemplateServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const autoscalingPolicyServiceClient = new AutoscalingPolicyServiceClient(); - doStuffWithAutoscalingPolicyServiceClient(autoscalingPolicyServiceClient); - // check that the client instance can be created - const batchControllerClient = new BatchControllerClient(); - doStuffWithBatchControllerClient(batchControllerClient); - // check that the client instance can be created - const clusterControllerClient = new ClusterControllerClient(); - doStuffWithClusterControllerClient(clusterControllerClient); - // check that the client instance can be created - const jobControllerClient = new JobControllerClient(); - doStuffWithJobControllerClient(jobControllerClient); - // check that the client instance can be created - const nodeGroupControllerClient = new NodeGroupControllerClient(); - doStuffWithNodeGroupControllerClient(nodeGroupControllerClient); - // check that the client instance can be created - const workflowTemplateServiceClient = new WorkflowTemplateServiceClient(); - doStuffWithWorkflowTemplateServiceClient(workflowTemplateServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts b/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a865..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts deleted file mode 100644 index f1e5a2b2b7e5..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_autoscaling_policy_service_v1.ts +++ /dev/null @@ -1,1509 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as autoscalingpolicyserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos} 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 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.AutoscalingPolicyServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.autoscalingPolicyServiceStub, undefined); - await client.initialize(); - assert(client.autoscalingPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.autoscalingPolicyServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.autoscalingPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - 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 autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - 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('createAutoscalingPolicy', () => { - it('invokes createAutoscalingPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.createAutoscalingPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.createAutoscalingPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAutoscalingPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.createAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAutoscalingPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAutoscalingPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAutoscalingPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAutoscalingPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAutoscalingPolicy with closed client', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAutoscalingPolicy(request), expectedError); - }); - }); - - describe('updateAutoscalingPolicy', () => { - it('invokes updateAutoscalingPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.updateAutoscalingPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAutoscalingPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAutoscalingPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAutoscalingPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedHeaderRequestParams = `policy.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAutoscalingPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAutoscalingPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAutoscalingPolicy with closed client', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest() - ); - request.policy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest', ['policy', 'name']); - request.policy.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAutoscalingPolicy(request), expectedError); - }); - }); - - describe('getAutoscalingPolicy', () => { - it('invokes getAutoscalingPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.getAutoscalingPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAutoscalingPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAutoscalingPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.AutoscalingPolicy() - ); - client.innerApiCalls.getAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAutoscalingPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAutoscalingPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAutoscalingPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAutoscalingPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAutoscalingPolicy with closed client', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAutoscalingPolicy(request), expectedError); - }); - }); - - describe('deleteAutoscalingPolicy', () => { - it('invokes deleteAutoscalingPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAutoscalingPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAutoscalingPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAutoscalingPolicy( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAutoscalingPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAutoscalingPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAutoscalingPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAutoscalingPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAutoscalingPolicy with closed client', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAutoscalingPolicy(request), expectedError); - }); - }); - - describe('listAutoscalingPolicies', () => { - it('invokes listAutoscalingPolicies without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - ]; - client.innerApiCalls.listAutoscalingPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAutoscalingPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAutoscalingPolicies without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - ]; - client.innerApiCalls.listAutoscalingPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAutoscalingPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAutoscalingPolicies with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAutoscalingPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAutoscalingPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAutoscalingPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAutoscalingPoliciesStream without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - ]; - client.descriptors.page.listAutoscalingPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAutoscalingPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.AutoscalingPolicy[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.AutoscalingPolicy) => { - 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.listAutoscalingPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAutoscalingPolicies, request)); - assert( - (client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAutoscalingPoliciesStream with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAutoscalingPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAutoscalingPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.AutoscalingPolicy[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.AutoscalingPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAutoscalingPolicies, request)); - assert( - (client.descriptors.page.listAutoscalingPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAutoscalingPolicies without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.AutoscalingPolicy()), - ]; - client.descriptors.page.listAutoscalingPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[] = []; - const iterable = client.listAutoscalingPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAutoscalingPolicies with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAutoscalingPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAutoscalingPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dataproc.v1.IAutoscalingPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAutoscalingPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('Path templates', () => { - - describe('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - 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('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - 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('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new autoscalingpolicyserviceModule.v1.AutoscalingPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts deleted file mode 100644 index a1cb43b9c6aa..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_batch_controller_v1.ts +++ /dev/null @@ -1,1714 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as batchcontrollerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos} 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.BatchControllerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = batchcontrollerModule.v1.BatchControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = batchcontrollerModule.v1.BatchControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = batchcontrollerModule.v1.BatchControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new batchcontrollerModule.v1.BatchControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.batchControllerStub, undefined); - await client.initialize(); - assert(client.batchControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.batchControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.batchControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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('getBatch', () => { - it('invokes getBatch without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Batch() - ); - client.innerApiCalls.getBatch = stubSimpleCall(expectedResponse); - const [response] = await client.getBatch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBatch without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Batch() - ); - client.innerApiCalls.getBatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBatch( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IBatch|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBatch with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBatch(request), expectedError); - const actualRequest = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBatch with closed client', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetBatchRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBatch(request), expectedError); - }); - }); - - describe('deleteBatch', () => { - it('invokes deleteBatch without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBatch = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBatch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBatch without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBatch( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBatch with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBatch(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBatch with closed client', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteBatchRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBatch(request), expectedError); - }); - }); - - describe('createBatch', () => { - it('invokes createBatch without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBatch = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBatch(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBatch without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBatch = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBatch( - 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.createBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBatch with call error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBatch = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBatch(request), expectedError); - const actualRequest = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBatch with LRO error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateBatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateBatchRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBatch = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBatch(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBatch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBatchProgress without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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.checkCreateBatchProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBatchProgress with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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.checkCreateBatchProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBatches', () => { - it('invokes listBatches without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - ]; - client.innerApiCalls.listBatches = stubSimpleCall(expectedResponse); - const [response] = await client.listBatches(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBatches without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - ]; - client.innerApiCalls.listBatches = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBatches( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IBatch[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBatches with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBatches = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBatches(request), expectedError); - const actualRequest = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBatches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBatchesStream without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - ]; - client.descriptors.page.listBatches.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBatchesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Batch[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Batch) => { - 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.listBatches.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBatches, request)); - assert( - (client.descriptors.page.listBatches.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBatchesStream with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBatches.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBatchesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Batch[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Batch) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBatches.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBatches, request)); - assert( - (client.descriptors.page.listBatches.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBatches without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Batch()), - ]; - client.descriptors.page.listBatches.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dataproc.v1.IBatch[] = []; - const iterable = client.listBatchesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBatches.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBatches.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBatches with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListBatchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListBatchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBatches.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBatchesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dataproc.v1.IBatch[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBatches.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBatches.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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 batchcontrollerModule.v1.BatchControllerClient({ - 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('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - 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('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new batchcontrollerModule.v1.BatchControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts deleted file mode 100644 index 2dbf25dd176a..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_cluster_controller_v1.ts +++ /dev/null @@ -1,2531 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as clustercontrollerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos} 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.ClusterControllerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = clustercontrollerModule.v1.ClusterControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = clustercontrollerModule.v1.ClusterControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = clustercontrollerModule.v1.ClusterControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterControllerStub, undefined); - await client.initialize(); - assert(client.clusterControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.clusterControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.clusterControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - 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.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateClusterRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkCreateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkCreateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - 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.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkUpdateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkUpdateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopCluster', () => { - it('invokes stopCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StopClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StopClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopCluster( - 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.stopCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StopClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StopClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StopClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkStopClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkStopClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startCluster', () => { - it('invokes startCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StartClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.startCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StartClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startCluster( - 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.startCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StartClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.StartClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.StartClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkStartClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkStartClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - 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.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkDeleteClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkDeleteClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('diagnoseCluster', () => { - it('invokes diagnoseCluster without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.diagnoseCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.diagnoseCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes diagnoseCluster without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.diagnoseCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.diagnoseCluster( - 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.diagnoseCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes diagnoseCluster with call error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.diagnoseCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.diagnoseCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes diagnoseCluster with LRO error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DiagnoseClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DiagnoseClusterRequest', ['clusterName']); - request.clusterName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&cluster_name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.diagnoseCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.diagnoseCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.diagnoseCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDiagnoseClusterProgress without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkDiagnoseClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDiagnoseClusterProgress with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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.checkDiagnoseClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.ICluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClusters with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listClustersStream without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - ]; - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Cluster) => { - 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.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listClustersStream with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClusters without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Cluster()), - ]; - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dataproc.v1.ICluster[] = []; - const iterable = client.listClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClusters with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListClustersRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dataproc.v1.ICluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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 clustercontrollerModule.v1.ClusterControllerClient({ - 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('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new clustercontrollerModule.v1.ClusterControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts deleted file mode 100644 index 5598c8014fde..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_job_controller_v1.ts +++ /dev/null @@ -1,2111 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as jobcontrollerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos} 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.JobControllerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = jobcontrollerModule.v1.JobControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = jobcontrollerModule.v1.JobControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = jobcontrollerModule.v1.JobControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new jobcontrollerModule.v1.JobControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobControllerStub, undefined); - await client.initialize(); - assert(client.jobControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.jobControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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('submitJob', () => { - it('invokes submitJob without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.submitJob = stubSimpleCall(expectedResponse); - const [response] = await client.submitJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJob without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.submitJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.submitJob( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJob with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.submitJob(request), expectedError); - const actualRequest = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJob with closed client', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.submitJob(request), expectedError); - }); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with closed client', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJob(request), expectedError); - }); - }); - - describe('updateJob', () => { - it('invokes updateJob without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJob( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJob(request), expectedError); - const actualRequest = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJob with closed client', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateJob(request), expectedError); - }); - }); - - describe('cancelJob', () => { - it('invokes cancelJob without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.cancelJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.Job() - ); - client.innerApiCalls.cancelJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelJob( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with closed client', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CancelJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelJob(request), expectedError); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}&job_id=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with closed client', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteJob(request), expectedError); - }); - }); - - describe('submitJobAsOperation', () => { - it('invokes submitJobAsOperation without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(expectedResponse); - const [operation] = await client.submitJobAsOperation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJobAsOperation without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitJobAsOperation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.submitJobAsOperation( - 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.submitJobAsOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJobAsOperation with call error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.submitJobAsOperation(request), expectedError); - const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes submitJobAsOperation with LRO error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.SubmitJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.SubmitJobRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitJobAsOperation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.submitJobAsOperation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitJobAsOperation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSubmitJobAsOperationProgress without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - 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.checkSubmitJobAsOperationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSubmitJobAsOperationProgress with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - 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.checkSubmitJobAsOperationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Job) => { - 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.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.Job()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dataproc.v1.IJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListJobsRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}®ion=${defaultValue2}`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dataproc.v1.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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 jobcontrollerModule.v1.JobControllerClient({ - 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('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new jobcontrollerModule.v1.JobControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts deleted file mode 100644 index 8cec8145d48c..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_node_group_controller_v1.ts +++ /dev/null @@ -1,1534 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as nodegroupcontrollerModule from '../src'; - -import {protobuf, LROperation, operationsProtos, IamProtos} 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 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.NodeGroupControllerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = nodegroupcontrollerModule.v1.NodeGroupControllerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = nodegroupcontrollerModule.v1.NodeGroupControllerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = nodegroupcontrollerModule.v1.NodeGroupControllerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.nodeGroupControllerStub, undefined); - await client.initialize(); - assert(client.nodeGroupControllerStub); - }); - - it('has close method for the initialized client', done => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.nodeGroupControllerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.nodeGroupControllerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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('getNodeGroup', () => { - it('invokes getNodeGroup without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.NodeGroup() - ); - client.innerApiCalls.getNodeGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getNodeGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeGroup without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.NodeGroup() - ); - client.innerApiCalls.getNodeGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNodeGroup( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.INodeGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeGroup with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNodeGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNodeGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNodeGroup with closed client', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNodeGroup(request), expectedError); - }); - }); - - describe('createNodeGroup', () => { - it('invokes createNodeGroup without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNodeGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNodeGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodeGroup without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNodeGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNodeGroup( - 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.createNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodeGroup with call error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNodeGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNodeGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNodeGroup with LRO error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateNodeGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNodeGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNodeGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateNodeGroupProgress without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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.checkCreateNodeGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateNodeGroupProgress with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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.checkCreateNodeGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('resizeNodeGroup', () => { - it('invokes resizeNodeGroup without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.resizeNodeGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resizeNodeGroup without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resizeNodeGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resizeNodeGroup( - 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.resizeNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resizeNodeGroup with call error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resizeNodeGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resizeNodeGroup with LRO error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ResizeNodeGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ResizeNodeGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resizeNodeGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resizeNodeGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resizeNodeGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkResizeNodeGroupProgress without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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.checkResizeNodeGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkResizeNodeGroupProgress with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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.checkResizeNodeGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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 nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('clusterRegion', () => { - const fakePath = "/rendered/path/clusterRegion"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterRegionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterRegionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterRegionPath', () => { - const result = client.clusterRegionPath("projectValue", "regionValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterRegionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterRegionName', () => { - const result = client.matchProjectFromClusterRegionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromClusterRegionName', () => { - const result = client.matchRegionFromClusterRegionName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterRegionName', () => { - const result = client.matchClusterFromClusterRegionName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterRegionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - 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('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('region', () => { - const fakePath = "/rendered/path/region"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - }; - const client = new nodegroupcontrollerModule.v1.NodeGroupControllerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.regionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.regionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('regionPath', () => { - const result = client.regionPath("projectValue", "regionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.regionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRegionName', () => { - const result = client.matchProjectFromRegionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.regionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromRegionName', () => { - const result = client.matchRegionFromRegionName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.regionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts b/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts deleted file mode 100644 index f20e78e5220e..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/v1/test/gapic_workflow_template_service_v1.ts +++ /dev/null @@ -1,2088 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as workflowtemplateserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos} 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.WorkflowTemplateServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowTemplateServiceStub, undefined); - await client.initialize(); - assert(client.workflowTemplateServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowTemplateServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowTemplateServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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('createWorkflowTemplate', () => { - it('invokes createWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.createWorkflowTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createWorkflowTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.createWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkflowTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflowTemplate with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkflowTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createWorkflowTemplate with closed client', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.CreateWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createWorkflowTemplate(request), expectedError); - }); - }); - - describe('getWorkflowTemplate', () => { - it('invokes getWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.getWorkflowTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkflowTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.getWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkflowTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflowTemplate with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkflowTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getWorkflowTemplate with closed client', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.GetWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.GetWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkflowTemplate(request), expectedError); - }); - }); - - describe('updateWorkflowTemplate', () => { - it('invokes updateWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() - ); - request.template ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); - request.template.name = defaultValue1; - const expectedHeaderRequestParams = `template.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.updateWorkflowTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateWorkflowTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() - ); - request.template ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); - request.template.name = defaultValue1; - const expectedHeaderRequestParams = `template.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dataproc.v1.WorkflowTemplate() - ); - client.innerApiCalls.updateWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkflowTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflowTemplate with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() - ); - request.template ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); - request.template.name = defaultValue1; - const expectedHeaderRequestParams = `template.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkflowTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateWorkflowTemplate with closed client', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest() - ); - request.template ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest', ['template', 'name']); - request.template.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateWorkflowTemplate(request), expectedError); - }); - }); - - describe('deleteWorkflowTemplate', () => { - it('invokes deleteWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteWorkflowTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkflowTemplate( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflowTemplate with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkflowTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteWorkflowTemplate with closed client', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteWorkflowTemplate(request), expectedError); - }); - }); - - describe('instantiateWorkflowTemplate', () => { - it('invokes instantiateWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(expectedResponse); - const [operation] = await client.instantiateWorkflowTemplate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.instantiateWorkflowTemplate( - 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.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateWorkflowTemplate with call error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.instantiateWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateWorkflowTemplate with LRO error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.instantiateWorkflowTemplate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.instantiateWorkflowTemplate(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkInstantiateWorkflowTemplateProgress without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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.checkInstantiateWorkflowTemplateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkInstantiateWorkflowTemplateProgress with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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.checkInstantiateWorkflowTemplateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('instantiateInlineWorkflowTemplate', () => { - it('invokes instantiateInlineWorkflowTemplate without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(expectedResponse); - const [operation] = await client.instantiateInlineWorkflowTemplate(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateInlineWorkflowTemplate without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.instantiateInlineWorkflowTemplate( - 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.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateInlineWorkflowTemplate with call error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.instantiateInlineWorkflowTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes instantiateInlineWorkflowTemplate with LRO error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.instantiateInlineWorkflowTemplate = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.instantiateInlineWorkflowTemplate(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.instantiateInlineWorkflowTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkInstantiateInlineWorkflowTemplateProgress without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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.checkInstantiateInlineWorkflowTemplateProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkInstantiateInlineWorkflowTemplateProgress with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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.checkInstantiateInlineWorkflowTemplateProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listWorkflowTemplates', () => { - it('invokes listWorkflowTemplates without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - ]; - client.innerApiCalls.listWorkflowTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkflowTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflowTemplates without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - ]; - client.innerApiCalls.listWorkflowTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkflowTemplates( - request, - (err?: Error|null, result?: protos.google.cloud.dataproc.v1.IWorkflowTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflowTemplates with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkflowTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkflowTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkflowTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listWorkflowTemplatesStream without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - ]; - client.descriptors.page.listWorkflowTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkflowTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.WorkflowTemplate[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.WorkflowTemplate) => { - 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.listWorkflowTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflowTemplates, request)); - assert( - (client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listWorkflowTemplatesStream with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflowTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkflowTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dataproc.v1.WorkflowTemplate[] = []; - stream.on('data', (response: protos.google.cloud.dataproc.v1.WorkflowTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkflowTemplates, request)); - assert( - (client.descriptors.page.listWorkflowTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflowTemplates without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - generateSampleMessage(new protos.google.cloud.dataproc.v1.WorkflowTemplate()), - ]; - client.descriptors.page.listWorkflowTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dataproc.v1.IWorkflowTemplate[] = []; - const iterable = client.listWorkflowTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listWorkflowTemplates with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dataproc.v1.ListWorkflowTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkflowTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkflowTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dataproc.v1.IWorkflowTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listWorkflowTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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 workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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('batch', () => { - const fakePath = "/rendered/path/batch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - batch: "batchValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.batchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.batchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('batchPath', () => { - const result = client.batchPath("projectValue", "locationValue", "batchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.batchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBatchName', () => { - const result = client.matchProjectFromBatchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBatchName', () => { - const result = client.matchLocationFromBatchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBatchFromBatchName', () => { - const result = client.matchBatchFromBatchName(fakePath); - assert.strictEqual(result, "batchValue"); - assert((client.pathTemplates.batchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('nodeGroup', () => { - const fakePath = "/rendered/path/nodeGroup"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - cluster: "clusterValue", - node_group: "nodeGroupValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodeGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeGroupPath', () => { - const result = client.nodeGroupPath("projectValue", "regionValue", "clusterValue", "nodeGroupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeGroupName', () => { - const result = client.matchProjectFromNodeGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromNodeGroupName', () => { - const result = client.matchRegionFromNodeGroupName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeGroupName', () => { - const result = client.matchClusterFromNodeGroupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeGroupFromNodeGroupName', () => { - const result = client.matchNodeGroupFromNodeGroupName(fakePath); - assert.strictEqual(result, "nodeGroupValue"); - assert((client.pathTemplates.nodeGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - 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('projectLocationAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectLocationAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationAutoscalingPolicyPath', () => { - const result = client.projectLocationAutoscalingPolicyPath("projectValue", "locationValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchLocationFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectLocationAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectLocationWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow_template: "workflowTemplateValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationWorkflowTemplatePath', () => { - const result = client.projectLocationWorkflowTemplatePath("projectValue", "locationValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchLocationFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectLocationWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectLocationWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionAutoscalingPolicy', () => { - const fakePath = "/rendered/path/projectRegionAutoscalingPolicy"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - autoscaling_policy: "autoscalingPolicyValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionAutoscalingPolicyPath', () => { - const result = client.projectRegionAutoscalingPolicyPath("projectValue", "regionValue", "autoscalingPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchProjectFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchRegionFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName', () => { - const result = client.matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(fakePath); - assert.strictEqual(result, "autoscalingPolicyValue"); - assert((client.pathTemplates.projectRegionAutoscalingPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectRegionWorkflowTemplate', () => { - const fakePath = "/rendered/path/projectRegionWorkflowTemplate"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - workflow_template: "workflowTemplateValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectRegionWorkflowTemplatePath', () => { - const result = client.projectRegionWorkflowTemplatePath("projectValue", "regionValue", "workflowTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchProjectFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchRegionFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowTemplateFromProjectRegionWorkflowTemplateName', () => { - const result = client.matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(fakePath); - assert.strictEqual(result, "workflowTemplateValue"); - assert((client.pathTemplates.projectRegionWorkflowTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('region', () => { - const fakePath = "/rendered/path/region"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - }; - const client = new workflowtemplateserviceModule.v1.WorkflowTemplateServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.regionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.regionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('regionPath', () => { - const result = client.regionPath("projectValue", "regionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.regionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRegionName', () => { - const result = client.matchProjectFromRegionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.regionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromRegionName', () => { - const result = client.matchRegionFromRegionName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.regionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json b/owl-bot-staging/google-cloud-dataproc/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef6..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/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-dataproc/v1/webpack.config.js b/owl-bot-staging/google-cloud-dataproc/v1/webpack.config.js deleted file mode 100644 index 050b272c0e03..000000000000 --- a/owl-bot-staging/google-cloud-dataproc/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: 'dataproc', - filename: './dataproc.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-dataproc/protos/google/cloud/dataproc/v1/clusters.proto b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto index 854a6059365c..03a4e8d60061 100644 --- a/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto +++ b/packages/google-cloud-dataproc/protos/google/cloud/dataproc/v1/clusters.proto @@ -25,6 +25,8 @@ import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/interval.proto"; option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb"; option java_multiple_files = true; @@ -671,22 +673,20 @@ message InstanceGroupConfig { // Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu). string min_cpu_platform = 9 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The minimum number of instances to create. - // If min_num_instances is set, min_num_instances is used for a criteria to - // decide the cluster. Cluster creation will be failed by being an error state - // if the total number of instances created is less than the - // min_num_instances. - // For example, given that num_instances = 5 and min_num_instances = 3, - // * if 4 instances are created and then registered successfully but one - // instance is failed, the failed VM will be deleted and the cluster will be - // resized to 4 instances in running state. - // * if 2 instances are created successfully and 3 instances are failed, - // the cluster will be in an error state and does not delete failed VMs for - // debugging. - // * if 2 instance are created and then registered successfully but 3 - // instances are failed to initialize, the cluster will be in an error state - // and does not delete failed VMs for debugging. - // NB: This can only be set for primary workers now. + // Optional. The minimum number of primary worker instances to create. + // If `min_num_instances` is set, cluster creation will succeed if + // the number of primary workers created is at least equal to the + // `min_num_instances` number. + // + // Example: Cluster creation request with `num_instances` = `5` and + // `min_num_instances` = `3`: + // + // * If 4 VMs are created and 1 instance fails, + // the failed VM is deleted. The cluster is + // resized to 4 instances and placed in a `RUNNING` state. + // * If 2 instances are created and 3 instances fail, + // the cluster in placed in an `ERROR` state. The failed VMs + // are not deleted. int32 min_num_instances = 12 [(google.api.field_behavior) = OPTIONAL]; // Optional. Instance flexibility Policy allowing a mixture of VM shapes and @@ -843,12 +843,12 @@ message NodeGroup { pattern: "projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}" }; - // Node group roles. + // Node pool roles. enum Role { // Required unspecified role. ROLE_UNSPECIFIED = 0; - // Job drivers run on the node group. + // Job drivers run on the node pool. DRIVER = 1; } @@ -1531,6 +1531,25 @@ message DiagnoseClusterRequest { // Required. The cluster name. string cluster_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The output Cloud Storage directory for the diagnostic + // tarball. If not specified, a task-specific directory in the cluster's + // staging bucket will be used. + string tarball_gcs_dir = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Time interval in which diagnosis should be carried out on the + // cluster. + google.type.Interval diagnosis_interval = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies a list of jobs on which diagnosis is to be performed. + // Format: projects/{project}/regions/{region}/jobs/{job} + repeated string jobs = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies a list of yarn applications on which diagnosis is to be + // performed. + repeated string yarn_application_ids = 11 + [(google.api.field_behavior) = OPTIONAL]; } // The location of diagnostic output. diff --git a/packages/google-cloud-dataproc/protos/protos.d.ts b/packages/google-cloud-dataproc/protos/protos.d.ts index c391b761258e..03ccf0259cc5 100644 --- a/packages/google-cloud-dataproc/protos/protos.d.ts +++ b/packages/google-cloud-dataproc/protos/protos.d.ts @@ -9396,6 +9396,18 @@ export namespace google { /** DiagnoseClusterRequest clusterName */ clusterName?: (string|null); + + /** DiagnoseClusterRequest tarballGcsDir */ + tarballGcsDir?: (string|null); + + /** DiagnoseClusterRequest diagnosisInterval */ + diagnosisInterval?: (google.type.IInterval|null); + + /** DiagnoseClusterRequest jobs */ + jobs?: (string[]|null); + + /** DiagnoseClusterRequest yarnApplicationIds */ + yarnApplicationIds?: (string[]|null); } /** Represents a DiagnoseClusterRequest. */ @@ -9416,6 +9428,18 @@ export namespace google { /** DiagnoseClusterRequest clusterName. */ public clusterName: string; + /** DiagnoseClusterRequest tarballGcsDir. */ + public tarballGcsDir: string; + + /** DiagnoseClusterRequest diagnosisInterval. */ + public diagnosisInterval?: (google.type.IInterval|null); + + /** DiagnoseClusterRequest jobs. */ + public jobs: string[]; + + /** DiagnoseClusterRequest yarnApplicationIds. */ + public yarnApplicationIds: string[]; + /** * Creates a new DiagnoseClusterRequest instance using the specified properties. * @param [properties] Properties to set @@ -22685,372 +22709,1245 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } - } - /** Namespace longrunning. */ - namespace longrunning { + /** Properties of a DoubleValue. */ + interface IDoubleValue { - /** Represents an Operations */ - class Operations extends $protobuf.rpc.Service { + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { /** - * Constructs a new Operations service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new DoubleValue. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; /** - * Creates new Operations 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. + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Operations; + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; /** - * Calls ListOperations. - * @param request ListOperationsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ListOperations. - * @param request ListOperationsRequest message or plain object - * @returns Promise + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetOperation. - * @param request GetOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; /** - * Calls GetOperation. - * @param request GetOperationRequest message or plain object - * @returns Promise + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; /** - * Calls DeleteOperation. - * @param request DeleteOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls DeleteOperation. - * @param request DeleteOperationRequest message or plain object - * @returns Promise + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue */ - public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; /** - * Calls CancelOperation. - * @param request CancelOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object */ - public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls CancelOperation. - * @param request CancelOperationRequest message or plain object - * @returns Promise + * Converts this DoubleValue to JSON. + * @returns JSON object */ - public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + public toJSON(): { [k: string]: any }; /** - * Calls WaitOperation. - * @param request WaitOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Gets the default type url for DoubleValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url */ - public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FloatValue. */ + interface IFloatValue { + + /** FloatValue value */ + value?: (number|null); + } + + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { /** - * Calls WaitOperation. - * @param request WaitOperationRequest message or plain object - * @returns Promise + * Constructs a new FloatValue. + * @param [properties] Properties to set */ - public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; - } + constructor(properties?: google.protobuf.IFloatValue); - namespace Operations { + /** FloatValue value. */ + public value: number; /** - * Callback as used by {@link google.longrunning.Operations|listOperations}. - * @param error Error, if any - * @param [response] ListOperationsResponse + * Creates a new FloatValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FloatValue instance */ - type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; /** - * Callback as used by {@link google.longrunning.Operations|getOperation}. - * @param error Error, if any - * @param [response] Operation + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.longrunning.Operations|deleteOperation}. - * @param error Error, if any - * @param [response] Empty + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.longrunning.Operations|cancelOperation}. - * @param error Error, if any - * @param [response] Empty + * Decodes a FloatValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FloatValue; /** - * Callback as used by {@link google.longrunning.Operations|waitOperation}. - * @param error Error, if any - * @param [response] Operation + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FloatValue; - /** Properties of an Operation. */ - interface IOperation { + /** + * Verifies a FloatValue 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); - /** Operation name */ - name?: (string|null); + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FloatValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; - /** Operation metadata */ - metadata?: (google.protobuf.IAny|null); + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @param message FloatValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Operation done */ - done?: (boolean|null); + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** Operation error */ - error?: (google.rpc.IStatus|null); + /** + * Gets the default type url for FloatValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** Operation response */ - response?: (google.protobuf.IAny|null); + /** Properties of an Int64Value. */ + interface IInt64Value { + + /** Int64Value value */ + value?: (number|Long|string|null); } - /** Represents an Operation. */ - class Operation implements IOperation { + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { /** - * Constructs a new Operation. + * Constructs a new Int64Value. * @param [properties] Properties to set */ - constructor(properties?: google.longrunning.IOperation); - - /** Operation name. */ - public name: string; - - /** Operation metadata. */ - public metadata?: (google.protobuf.IAny|null); - - /** Operation done. */ - public done: boolean; - - /** Operation error. */ - public error?: (google.rpc.IStatus|null); - - /** Operation response. */ - public response?: (google.protobuf.IAny|null); + constructor(properties?: google.protobuf.IInt64Value); - /** Operation result. */ - public result?: ("error"|"response"); + /** Int64Value value. */ + public value: (number|Long|string); /** - * Creates a new Operation instance using the specified properties. + * Creates a new Int64Value instance using the specified properties. * @param [properties] Properties to set - * @returns Operation instance + * @returns Int64Value instance */ - public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; /** - * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Operation message from the specified reader or buffer. + * Decodes an Int64Value message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Operation + * @returns Int64Value * @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.longrunning.Operation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; /** - * Decodes an Operation message from the specified reader or buffer, length delimited. + * Decodes an Int64Value message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Operation + * @returns Int64Value * @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.longrunning.Operation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; /** - * Verifies an Operation message. + * Verifies an Int64Value 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 Operation message from a plain object. Also converts values to their respective internal types. + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Operation + * @returns Int64Value */ - public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @param message Operation + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @param message Int64Value * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Operation to JSON. + * Converts this Int64Value to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Operation + * Gets the default type url for Int64Value * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a GetOperationRequest. */ - interface IGetOperationRequest { + /** Properties of a UInt64Value. */ + interface IUInt64Value { - /** GetOperationRequest name */ - name?: (string|null); + /** UInt64Value value */ + value?: (number|Long|string|null); } - /** Represents a GetOperationRequest. */ - class GetOperationRequest implements IGetOperationRequest { + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { /** - * Constructs a new GetOperationRequest. + * Constructs a new UInt64Value. * @param [properties] Properties to set */ - constructor(properties?: google.longrunning.IGetOperationRequest); + constructor(properties?: google.protobuf.IUInt64Value); - /** GetOperationRequest name. */ - public name: string; + /** UInt64Value value. */ + public value: (number|Long|string); /** - * Creates a new GetOperationRequest instance using the specified properties. + * Creates a new UInt64Value instance using the specified properties. * @param [properties] Properties to set - * @returns GetOperationRequest instance + * @returns UInt64Value instance */ - public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; /** - * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @param message GetOperationRequest message or plain object to encode + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @param message GetOperationRequest message or plain object to encode + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetOperationRequest message from the specified reader or buffer. + * Decodes a UInt64Value message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetOperationRequest + * @returns UInt64Value * @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.longrunning.GetOperationRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt64Value; /** - * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetOperationRequest + * @returns UInt64Value * @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.longrunning.GetOperationRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt64Value; /** - * Verifies a GetOperationRequest message. + * Verifies a UInt64Value 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 GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetOperationRequest + * @returns UInt64Value */ - public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; /** - * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. - * @param message GetOperationRequest + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @param message UInt64Value * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetOperationRequest to JSON. + * Converts this UInt64Value to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for GetOperationRequest + * Gets the default type url for UInt64Value * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListOperationsRequest. */ - interface IListOperationsRequest { - - /** ListOperationsRequest name */ - name?: (string|null); + /** Properties of an Int32Value. */ + interface IInt32Value { - /** ListOperationsRequest filter */ - filter?: (string|null); + /** Int32Value value */ + value?: (number|null); + } - /** ListOperationsRequest pageSize */ - pageSize?: (number|null); + /** Represents an Int32Value. */ + class Int32Value implements IInt32Value { + + /** + * Constructs a new Int32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt32Value); + + /** Int32Value value. */ + public value: number; + + /** + * Creates a new Int32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int32Value instance + */ + public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int32Value + * @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.protobuf.Int32Value; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int32Value + * @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.protobuf.Int32Value; + + /** + * Verifies an Int32Value 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 Int32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @param message Int32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt32Value. */ + interface IUInt32Value { + + /** UInt32Value value */ + value?: (number|null); + } + + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { + + /** + * Constructs a new UInt32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt32Value); + + /** UInt32Value value. */ + public value: number; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt32Value instance + */ + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt32Value + * @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.protobuf.UInt32Value; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt32Value + * @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.protobuf.UInt32Value; + + /** + * Verifies a UInt32Value 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 UInt32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @param message UInt32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BoolValue. */ + interface IBoolValue { + + /** BoolValue value */ + value?: (boolean|null); + } + + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { + + /** + * Constructs a new BoolValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBoolValue); + + /** BoolValue value. */ + public value: boolean; + + /** + * Creates a new BoolValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BoolValue instance + */ + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoolValue + * @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.protobuf.BoolValue; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoolValue + * @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.protobuf.BoolValue; + + /** + * Verifies a BoolValue 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 BoolValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoolValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @param message BoolValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoolValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoolValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StringValue. */ + interface IStringValue { + + /** StringValue value */ + value?: (string|null); + } + + /** Represents a StringValue. */ + class StringValue implements IStringValue { + + /** + * Constructs a new StringValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStringValue); + + /** StringValue value. */ + public value: string; + + /** + * Creates a new StringValue instance using the specified properties. + * @param [properties] Properties to set + * @returns StringValue instance + */ + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StringValue + * @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.protobuf.StringValue; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StringValue + * @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.protobuf.StringValue; + + /** + * Verifies a StringValue 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 StringValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StringValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @param message StringValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StringValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StringValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BytesValue. */ + interface IBytesValue { + + /** BytesValue value */ + value?: (Uint8Array|string|null); + } + + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { + + /** + * Constructs a new BytesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBytesValue); + + /** BytesValue value. */ + public value: (Uint8Array|string); + + /** + * Creates a new BytesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BytesValue instance + */ + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BytesValue + * @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.protobuf.BytesValue; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BytesValue + * @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.protobuf.BytesValue; + + /** + * Verifies a BytesValue 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 BytesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BytesValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @param message BytesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BytesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BytesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace longrunning. */ + namespace longrunning { + + /** Represents an Operations */ + class Operations extends $protobuf.rpc.Service { + + /** + * Constructs a new Operations 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 Operations 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): Operations; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + */ + public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @returns Promise + */ + public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @returns Promise + */ + public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @returns Promise + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @returns Promise + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @returns Promise + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; + } + + namespace Operations { + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @param error Error, if any + * @param [response] ListOperationsResponse + */ + type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation name */ + name?: (string|null); + + /** Operation metadata */ + metadata?: (google.protobuf.IAny|null); + + /** Operation done */ + done?: (boolean|null); + + /** Operation error */ + error?: (google.rpc.IStatus|null); + + /** Operation response */ + response?: (google.protobuf.IAny|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperation); + + /** Operation name. */ + public name: string; + + /** Operation metadata. */ + public metadata?: (google.protobuf.IAny|null); + + /** Operation done. */ + public done: boolean; + + /** Operation error. */ + public error?: (google.rpc.IStatus|null); + + /** Operation response. */ + public response?: (google.protobuf.IAny|null); + + /** Operation result. */ + public result?: ("error"|"response"); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @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.longrunning.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @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.longrunning.Operation; + + /** + * Verifies an Operation 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 Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetOperationRequest. */ + interface IGetOperationRequest { + + /** GetOperationRequest name */ + name?: (string|null); + } + + /** Represents a GetOperationRequest. */ + class GetOperationRequest implements IGetOperationRequest { + + /** + * Constructs a new GetOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IGetOperationRequest); + + /** GetOperationRequest name. */ + public name: string; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetOperationRequest instance + */ + public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetOperationRequest + * @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.longrunning.GetOperationRequest; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetOperationRequest + * @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.longrunning.GetOperationRequest; + + /** + * Verifies a GetOperationRequest 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 GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @param message GetOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListOperationsRequest. */ + interface IListOperationsRequest { + + /** ListOperationsRequest name */ + name?: (string|null); + + /** ListOperationsRequest filter */ + filter?: (string|null); + + /** ListOperationsRequest pageSize */ + pageSize?: (number|null); /** ListOperationsRequest pageToken */ pageToken?: (string|null); @@ -23771,4 +24668,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-dataproc/protos/protos.js b/packages/google-cloud-dataproc/protos/protos.js index 253586cb2394..fcb7b9969de6 100644 --- a/packages/google-cloud-dataproc/protos/protos.js +++ b/packages/google-cloud-dataproc/protos/protos.js @@ -24027,6 +24027,10 @@ * @property {string|null} [projectId] DiagnoseClusterRequest projectId * @property {string|null} [region] DiagnoseClusterRequest region * @property {string|null} [clusterName] DiagnoseClusterRequest clusterName + * @property {string|null} [tarballGcsDir] DiagnoseClusterRequest tarballGcsDir + * @property {google.type.IInterval|null} [diagnosisInterval] DiagnoseClusterRequest diagnosisInterval + * @property {Array.|null} [jobs] DiagnoseClusterRequest jobs + * @property {Array.|null} [yarnApplicationIds] DiagnoseClusterRequest yarnApplicationIds */ /** @@ -24038,6 +24042,8 @@ * @param {google.cloud.dataproc.v1.IDiagnoseClusterRequest=} [properties] Properties to set */ function DiagnoseClusterRequest(properties) { + this.jobs = []; + this.yarnApplicationIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24068,6 +24074,38 @@ */ DiagnoseClusterRequest.prototype.clusterName = ""; + /** + * DiagnoseClusterRequest tarballGcsDir. + * @member {string} tarballGcsDir + * @memberof google.cloud.dataproc.v1.DiagnoseClusterRequest + * @instance + */ + DiagnoseClusterRequest.prototype.tarballGcsDir = ""; + + /** + * DiagnoseClusterRequest diagnosisInterval. + * @member {google.type.IInterval|null|undefined} diagnosisInterval + * @memberof google.cloud.dataproc.v1.DiagnoseClusterRequest + * @instance + */ + DiagnoseClusterRequest.prototype.diagnosisInterval = null; + + /** + * DiagnoseClusterRequest jobs. + * @member {Array.} jobs + * @memberof google.cloud.dataproc.v1.DiagnoseClusterRequest + * @instance + */ + DiagnoseClusterRequest.prototype.jobs = $util.emptyArray; + + /** + * DiagnoseClusterRequest yarnApplicationIds. + * @member {Array.} yarnApplicationIds + * @memberof google.cloud.dataproc.v1.DiagnoseClusterRequest + * @instance + */ + DiagnoseClusterRequest.prototype.yarnApplicationIds = $util.emptyArray; + /** * Creates a new DiagnoseClusterRequest instance using the specified properties. * @function create @@ -24098,6 +24136,16 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.clusterName); if (message.region != null && Object.hasOwnProperty.call(message, "region")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.region); + if (message.tarballGcsDir != null && Object.hasOwnProperty.call(message, "tarballGcsDir")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tarballGcsDir); + if (message.diagnosisInterval != null && Object.hasOwnProperty.call(message, "diagnosisInterval")) + $root.google.type.Interval.encode(message.diagnosisInterval, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.jobs != null && message.jobs.length) + for (var i = 0; i < message.jobs.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jobs[i]); + if (message.yarnApplicationIds != null && message.yarnApplicationIds.length) + for (var i = 0; i < message.yarnApplicationIds.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.yarnApplicationIds[i]); return writer; }; @@ -24144,6 +24192,26 @@ message.clusterName = reader.string(); break; } + case 4: { + message.tarballGcsDir = reader.string(); + break; + } + case 6: { + message.diagnosisInterval = $root.google.type.Interval.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.jobs && message.jobs.length)) + message.jobs = []; + message.jobs.push(reader.string()); + break; + } + case 11: { + if (!(message.yarnApplicationIds && message.yarnApplicationIds.length)) + message.yarnApplicationIds = []; + message.yarnApplicationIds.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -24188,6 +24256,28 @@ if (message.clusterName != null && message.hasOwnProperty("clusterName")) if (!$util.isString(message.clusterName)) return "clusterName: string expected"; + if (message.tarballGcsDir != null && message.hasOwnProperty("tarballGcsDir")) + if (!$util.isString(message.tarballGcsDir)) + return "tarballGcsDir: string expected"; + if (message.diagnosisInterval != null && message.hasOwnProperty("diagnosisInterval")) { + var error = $root.google.type.Interval.verify(message.diagnosisInterval); + if (error) + return "diagnosisInterval." + error; + } + if (message.jobs != null && message.hasOwnProperty("jobs")) { + if (!Array.isArray(message.jobs)) + return "jobs: array expected"; + for (var i = 0; i < message.jobs.length; ++i) + if (!$util.isString(message.jobs[i])) + return "jobs: string[] expected"; + } + if (message.yarnApplicationIds != null && message.hasOwnProperty("yarnApplicationIds")) { + if (!Array.isArray(message.yarnApplicationIds)) + return "yarnApplicationIds: array expected"; + for (var i = 0; i < message.yarnApplicationIds.length; ++i) + if (!$util.isString(message.yarnApplicationIds[i])) + return "yarnApplicationIds: string[] expected"; + } return null; }; @@ -24209,6 +24299,27 @@ message.region = String(object.region); if (object.clusterName != null) message.clusterName = String(object.clusterName); + if (object.tarballGcsDir != null) + message.tarballGcsDir = String(object.tarballGcsDir); + if (object.diagnosisInterval != null) { + if (typeof object.diagnosisInterval !== "object") + throw TypeError(".google.cloud.dataproc.v1.DiagnoseClusterRequest.diagnosisInterval: object expected"); + message.diagnosisInterval = $root.google.type.Interval.fromObject(object.diagnosisInterval); + } + if (object.jobs) { + if (!Array.isArray(object.jobs)) + throw TypeError(".google.cloud.dataproc.v1.DiagnoseClusterRequest.jobs: array expected"); + message.jobs = []; + for (var i = 0; i < object.jobs.length; ++i) + message.jobs[i] = String(object.jobs[i]); + } + if (object.yarnApplicationIds) { + if (!Array.isArray(object.yarnApplicationIds)) + throw TypeError(".google.cloud.dataproc.v1.DiagnoseClusterRequest.yarnApplicationIds: array expected"); + message.yarnApplicationIds = []; + for (var i = 0; i < object.yarnApplicationIds.length; ++i) + message.yarnApplicationIds[i] = String(object.yarnApplicationIds[i]); + } return message; }; @@ -24225,10 +24336,16 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.jobs = []; + object.yarnApplicationIds = []; + } if (options.defaults) { object.projectId = ""; object.clusterName = ""; object.region = ""; + object.tarballGcsDir = ""; + object.diagnosisInterval = null; } if (message.projectId != null && message.hasOwnProperty("projectId")) object.projectId = message.projectId; @@ -24236,6 +24353,20 @@ object.clusterName = message.clusterName; if (message.region != null && message.hasOwnProperty("region")) object.region = message.region; + if (message.tarballGcsDir != null && message.hasOwnProperty("tarballGcsDir")) + object.tarballGcsDir = message.tarballGcsDir; + if (message.diagnosisInterval != null && message.hasOwnProperty("diagnosisInterval")) + object.diagnosisInterval = $root.google.type.Interval.toObject(message.diagnosisInterval, options); + if (message.jobs && message.jobs.length) { + object.jobs = []; + for (var j = 0; j < message.jobs.length; ++j) + object.jobs[j] = message.jobs[j]; + } + if (message.yarnApplicationIds && message.yarnApplicationIds.length) { + object.yarnApplicationIds = []; + for (var j = 0; j < message.yarnApplicationIds.length; ++j) + object.yarnApplicationIds[j] = message.yarnApplicationIds[j]; + } return object; }; @@ -59932,240 +60063,24 @@ return FieldMask; })(); - return protobuf; - })(); - - google.longrunning = (function() { - - /** - * Namespace longrunning. - * @memberof google - * @namespace - */ - var longrunning = {}; - - longrunning.Operations = (function() { - - /** - * Constructs a new Operations service. - * @memberof google.longrunning - * @classdesc Represents an Operations - * @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 Operations(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; - - /** - * Creates new Operations service using the specified rpc implementation. - * @function create - * @memberof google.longrunning.Operations - * @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 {Operations} RPC service. Useful where requests and/or responses are streamed. - */ - Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.longrunning.Operations|listOperations}. - * @memberof google.longrunning.Operations - * @typedef ListOperationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse - */ - - /** - * Calls ListOperations. - * @function listOperations - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object - * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { - return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); - }, "name", { value: "ListOperations" }); - - /** - * Calls ListOperations. - * @function listOperations - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|getOperation}. - * @memberof google.longrunning.Operations - * @typedef GetOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls GetOperation. - * @function getOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object - * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { - return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "GetOperation" }); - - /** - * Calls GetOperation. - * @function getOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|deleteOperation}. - * @memberof google.longrunning.Operations - * @typedef DeleteOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteOperation. - * @function deleteOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object - * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { - return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteOperation" }); - - /** - * Calls DeleteOperation. - * @function deleteOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|cancelOperation}. - * @memberof google.longrunning.Operations - * @typedef CancelOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls CancelOperation. - * @function cancelOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object - * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { - return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "CancelOperation" }); - - /** - * Calls CancelOperation. - * @function cancelOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|waitOperation}. - * @memberof google.longrunning.Operations - * @typedef WaitOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls WaitOperation. - * @function waitOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object - * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { - return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "WaitOperation" }); - - /** - * Calls WaitOperation. - * @function waitOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Operations; - })(); - - longrunning.Operation = (function() { + protobuf.DoubleValue = (function() { /** - * Properties of an Operation. - * @memberof google.longrunning - * @interface IOperation - * @property {string|null} [name] Operation name - * @property {google.protobuf.IAny|null} [metadata] Operation metadata - * @property {boolean|null} [done] Operation done - * @property {google.rpc.IStatus|null} [error] Operation error - * @property {google.protobuf.IAny|null} [response] Operation response + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value */ /** - * Constructs a new Operation. - * @memberof google.longrunning - * @classdesc Represents an Operation. - * @implements IOperation + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue * @constructor - * @param {google.longrunning.IOperation=} [properties] Properties to set + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set */ - function Operation(properties) { + function DoubleValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -60173,145 +60088,75 @@ } /** - * Operation name. - * @member {string} name - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.name = ""; - - /** - * Operation metadata. - * @member {google.protobuf.IAny|null|undefined} metadata - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.metadata = null; - - /** - * Operation done. - * @member {boolean} done - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.done = false; - - /** - * Operation error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.error = null; - - /** - * Operation response. - * @member {google.protobuf.IAny|null|undefined} response - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.response = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Operation result. - * @member {"error"|"response"|undefined} result - * @memberof google.longrunning.Operation + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue * @instance */ - Object.defineProperty(Operation.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["error", "response"]), - set: $util.oneOfSetter($oneOfFields) - }); + DoubleValue.prototype.value = 0; /** - * Creates a new Operation instance using the specified properties. + * Creates a new DoubleValue instance using the specified properties. * @function create - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static - * @param {google.longrunning.IOperation=} [properties] Properties to set - * @returns {google.longrunning.Operation} Operation instance + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance */ - Operation.create = function create(properties) { - return new Operation(properties); + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); }; /** - * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. * @function encode - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static - * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Operation.encode = function encode(message, writer) { + DoubleValue.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.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.done != null && Object.hasOwnProperty.call(message, "done")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.response != null && Object.hasOwnProperty.call(message, "response")) - $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); return writer; }; /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static - * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Operation.encodeDelimited = function encodeDelimited(message, writer) { + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Operation message from the specified reader or buffer. + * Decodes a DoubleValue message from the specified reader or buffer. * @function decode - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.Operation} Operation + * @returns {google.protobuf.DoubleValue} DoubleValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Operation.decode = function decode(reader, length) { + DoubleValue.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.longrunning.Operation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - } - case 3: { - message.done = reader.bool(); - break; - } - case 4: { - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - case 5: { - message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + message.value = reader.double(); break; } default: @@ -60323,183 +60168,122 @@ }; /** - * Decodes an Operation message from the specified reader or buffer, length delimited. + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.Operation} Operation + * @returns {google.protobuf.DoubleValue} DoubleValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Operation.decodeDelimited = function decodeDelimited(reader) { + DoubleValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Operation message. + * Verifies a DoubleValue message. * @function verify - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Operation.verify = function verify(message) { + DoubleValue.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.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.protobuf.Any.verify(message.metadata); - if (error) - return "metadata." + error; - } - if (message.done != null && message.hasOwnProperty("done")) - if (typeof message.done !== "boolean") - return "done: boolean expected"; - if (message.error != null && message.hasOwnProperty("error")) { - properties.result = 1; - { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } - } - if (message.response != null && message.hasOwnProperty("response")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.google.protobuf.Any.verify(message.response); - if (error) - return "response." + error; - } - } + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; return null; }; /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static * @param {Object.} object Plain object - * @returns {google.longrunning.Operation} Operation + * @returns {google.protobuf.DoubleValue} DoubleValue */ - Operation.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.Operation) + DoubleValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DoubleValue) return object; - var message = new $root.google.longrunning.Operation(); - if (object.name != null) - message.name = String(object.name); - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".google.longrunning.Operation.metadata: object expected"); - message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); - } - if (object.done != null) - message.done = Boolean(object.done); - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.longrunning.Operation.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } - if (object.response != null) { - if (typeof object.response !== "object") - throw TypeError(".google.longrunning.Operation.response: object expected"); - message.response = $root.google.protobuf.Any.fromObject(object.response); - } + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); return message; }; /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static - * @param {google.longrunning.Operation} message Operation + * @param {google.protobuf.DoubleValue} message DoubleValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Operation.toObject = function toObject(message, options) { + DoubleValue.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.name = ""; - object.metadata = null; - object.done = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); - if (message.done != null && message.hasOwnProperty("done")) - object.done = message.done; - if (message.error != null && message.hasOwnProperty("error")) { - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (options.oneofs) - object.result = "error"; - } - if (message.response != null && message.hasOwnProperty("response")) { - object.response = $root.google.protobuf.Any.toObject(message.response, options); - if (options.oneofs) - object.result = "response"; - } + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; return object; }; /** - * Converts this Operation to JSON. + * Converts this DoubleValue to JSON. * @function toJSON - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @instance * @returns {Object.} JSON object */ - Operation.prototype.toJSON = function toJSON() { + DoubleValue.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Operation + * Gets the default type url for DoubleValue * @function getTypeUrl - * @memberof google.longrunning.Operation + * @memberof google.protobuf.DoubleValue * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.longrunning.Operation"; + return typeUrlPrefix + "/google.protobuf.DoubleValue"; }; - return Operation; + return DoubleValue; })(); - longrunning.GetOperationRequest = (function() { + protobuf.FloatValue = (function() { /** - * Properties of a GetOperationRequest. - * @memberof google.longrunning - * @interface IGetOperationRequest - * @property {string|null} [name] GetOperationRequest name + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value */ /** - * Constructs a new GetOperationRequest. - * @memberof google.longrunning - * @classdesc Represents a GetOperationRequest. - * @implements IGetOperationRequest + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue * @constructor - * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @param {google.protobuf.IFloatValue=} [properties] Properties to set */ - function GetOperationRequest(properties) { + function FloatValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -60507,38 +60291,2249 @@ } /** - * GetOperationRequest name. - * @member {string} name - * @memberof google.longrunning.GetOperationRequest + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue * @instance */ - GetOperationRequest.prototype.name = ""; + FloatValue.prototype.value = 0; /** - * Creates a new GetOperationRequest instance using the specified properties. + * Creates a new FloatValue instance using the specified properties. * @function create - * @memberof google.longrunning.GetOperationRequest + * @memberof google.protobuf.FloatValue * @static - * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set - * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance */ - GetOperationRequest.create = function create(properties) { - return new GetOperationRequest(properties); + FloatValue.create = function create(properties) { + return new FloatValue(properties); }; /** - * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. * @function encode - * @memberof google.longrunning.GetOperationRequest + * @memberof google.protobuf.FloatValue * @static - * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetOperationRequest.encode = function encode(message, writer) { + FloatValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.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.protobuf.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FloatValue + * @function getTypeUrl + * @memberof google.protobuf.FloatValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FloatValue"; + }; + + return FloatValue; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(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]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.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.protobuf.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int64Value + * @function getTypeUrl + * @memberof google.protobuf.Int64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int64Value"; + }; + + return Int64Value; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(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]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.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.protobuf.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = true; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt64Value + * @function getTypeUrl + * @memberof google.protobuf.UInt64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt64Value"; + }; + + return UInt64Value; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(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]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.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.protobuf.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int32Value + * @function getTypeUrl + * @memberof google.protobuf.Int32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int32Value"; + }; + + return Int32Value; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(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]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.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.protobuf.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt32Value + * @function getTypeUrl + * @memberof google.protobuf.UInt32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt32Value"; + }; + + return UInt32Value; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(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]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.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.protobuf.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BoolValue + * @function getTypeUrl + * @memberof google.protobuf.BoolValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BoolValue"; + }; + + return BoolValue; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(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]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.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.protobuf.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StringValue + * @function getTypeUrl + * @memberof google.protobuf.StringValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.StringValue"; + }; + + return StringValue; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(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]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.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.protobuf.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.BytesValue} message BytesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BytesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this BytesValue to JSON. + * @function toJSON + * @memberof google.protobuf.BytesValue + * @instance + * @returns {Object.} JSON object + */ + BytesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BytesValue + * @function getTypeUrl + * @memberof google.protobuf.BytesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BytesValue"; + }; + + return BytesValue; + })(); + + return protobuf; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @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 Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @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 {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(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]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.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.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.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.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.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.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.longrunning.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.Operation"; + }; + + return Operation; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(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]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.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; }; @@ -62358,6 +64353,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-dataproc/protos/protos.json b/packages/google-cloud-dataproc/protos/protos.json index 5b2e96e27d48..6e6c25837b71 100644 --- a/packages/google-cloud-dataproc/protos/protos.json +++ b/packages/google-cloud-dataproc/protos/protos.json @@ -3050,6 +3050,36 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "tarballGcsDir": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "diagnosisInterval": { + "type": "google.type.Interval", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "jobs": { + "rule": "repeated", + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "yarnApplicationIds": { + "rule": "repeated", + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -7192,6 +7222,78 @@ "id": 1 } } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } } } }, @@ -7439,6 +7541,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-dataproc/samples/generated/v1/cluster_controller.diagnose_cluster.js b/packages/google-cloud-dataproc/samples/generated/v1/cluster_controller.diagnose_cluster.js index 308aa3c55864..78bbe9e700dd 100644 --- a/packages/google-cloud-dataproc/samples/generated/v1/cluster_controller.diagnose_cluster.js +++ b/packages/google-cloud-dataproc/samples/generated/v1/cluster_controller.diagnose_cluster.js @@ -41,6 +41,27 @@ function main(projectId, region, clusterName) { * Required. The cluster name. */ // const clusterName = 'abc123' + /** + * Optional. The output Cloud Storage directory for the diagnostic + * tarball. If not specified, a task-specific directory in the cluster's + * staging bucket will be used. + */ + // const tarballGcsDir = 'abc123' + /** + * Optional. Time interval in which diagnosis should be carried out on the + * cluster. + */ + // const diagnosisInterval = {} + /** + * Optional. Specifies a list of jobs on which diagnosis is to be performed. + * Format: projects/{project}/regions/{region}/jobs/{job} + */ + // const jobs = ['abc','def'] + /** + * Optional. Specifies a list of yarn applications on which diagnosis is to be + * performed. + */ + // const yarnApplicationIds = ['abc','def'] // Imports the Dataproc library const {ClusterControllerClient} = require('@google-cloud/dataproc').v1; diff --git a/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json b/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json index 1d15561eae37..1e40a50ad384 100644 --- a/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json +++ b/packages/google-cloud-dataproc/samples/generated/v1/snippet_metadata_google.cloud.dataproc.v1.json @@ -814,7 +814,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 86, "type": "FULL" } ], @@ -834,6 +834,22 @@ { "name": "cluster_name", "type": "TYPE_STRING" + }, + { + "name": "tarball_gcs_dir", + "type": "TYPE_STRING" + }, + { + "name": "diagnosis_interval", + "type": ".google.type.Interval" + }, + { + "name": "jobs", + "type": "TYPE_STRING[]" + }, + { + "name": "yarn_application_ids", + "type": "TYPE_STRING[]" } ], "resultType": ".google.longrunning.Operation", diff --git a/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts b/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts index 16acc3143ce2..e9d95df957f8 100644 --- a/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts +++ b/packages/google-cloud-dataproc/src/v1/cluster_controller_client.ts @@ -1545,6 +1545,19 @@ export class ClusterControllerClient { * Required. The Dataproc region in which to handle the request. * @param {string} request.clusterName * Required. The cluster name. + * @param {string} [request.tarballGcsDir] + * Optional. The output Cloud Storage directory for the diagnostic + * tarball. If not specified, a task-specific directory in the cluster's + * staging bucket will be used. + * @param {google.type.Interval} [request.diagnosisInterval] + * Optional. Time interval in which diagnosis should be carried out on the + * cluster. + * @param {string[]} [request.jobs] + * Optional. Specifies a list of jobs on which diagnosis is to be performed. + * Format: projects/{project}/regions/{region}/jobs/{job} + * @param {string[]} [request.yarnApplicationIds] + * Optional. Specifies a list of yarn applications on which diagnosis is to be + * performed. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.