From 2a2a3c26b73d580d10abcda33c76820790993321 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 23 Mar 2022 18:58:46 +0000 Subject: [PATCH 1/2] feat: Add ListHotTablets API method and protobufs PiperOrigin-RevId: 436758628 Source-Link: https://github.com/googleapis/googleapis/commit/92ab86a79f4a9e774dfd6ee533d9376af084b376 Source-Link: https://github.com/googleapis/googleapis-gen/commit/931ef114d5f845abf117bf8e0a29836ca300b694 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMxZWYxMTRkNWY4NDVhYmYxMTdiZjhlMGEyOTgzNmNhMzAwYjY5NCJ9 --- owl-bot-staging/admin/v2/.eslintignore | 7 + owl-bot-staging/admin/v2/.eslintrc.json | 3 + owl-bot-staging/admin/v2/.gitignore | 14 + owl-bot-staging/admin/v2/.jsdoc.js | 55 + owl-bot-staging/admin/v2/.mocharc.js | 33 + owl-bot-staging/admin/v2/.prettierrc.js | 22 + owl-bot-staging/admin/v2/README.md | 1 + .../admin/v2/linkinator.config.json | 16 + owl-bot-staging/admin/v2/package.json | 65 + .../admin/v2/bigtable_instance_admin.proto | 698 ++++ .../admin/v2/bigtable_table_admin.proto | 1003 +++++ .../google/bigtable/admin/v2/common.proto | 55 + .../google/bigtable/admin/v2/instance.proto | 333 ++ .../google/bigtable/admin/v2/table.proto | 405 ++ ...table_instance_admin.create_app_profile.js | 77 + .../bigtable_instance_admin.create_cluster.js | 74 + ...bigtable_instance_admin.create_instance.js | 82 + ...table_instance_admin.delete_app_profile.js | 64 + .../bigtable_instance_admin.delete_cluster.js | 59 + ...bigtable_instance_admin.delete_instance.js | 59 + ...bigtable_instance_admin.get_app_profile.js | 59 + .../v2/bigtable_instance_admin.get_cluster.js | 59 + .../bigtable_instance_admin.get_iam_policy.js | 64 + .../bigtable_instance_admin.get_instance.js | 59 + ...gtable_instance_admin.list_app_profiles.js | 78 + .../bigtable_instance_admin.list_clusters.js | 65 + ...igtable_instance_admin.list_hot_tablets.js | 89 + .../bigtable_instance_admin.list_instances.js | 63 + ...e_instance_admin.partial_update_cluster.js | 65 + ..._instance_admin.partial_update_instance.js | 65 + .../bigtable_instance_admin.set_iam_policy.js | 67 + ...ble_instance_admin.test_iam_permissions.js | 67 + ...table_instance_admin.update_app_profile.js | 69 + .../bigtable_instance_admin.update_cluster.js | 93 + ...bigtable_instance_admin.update_instance.js | 95 + .../bigtable_table_admin.check_consistency.js | 65 + .../v2/bigtable_table_admin.create_backup.js | 76 + .../v2/bigtable_table_admin.create_table.js | 88 + ..._table_admin.create_table_from_snapshot.js | 74 + .../v2/bigtable_table_admin.delete_backup.js | 60 + .../bigtable_table_admin.delete_snapshot.js | 60 + .../v2/bigtable_table_admin.delete_table.js | 60 + .../v2/bigtable_table_admin.drop_row_range.js | 69 + ..._table_admin.generate_consistency_token.js | 60 + .../v2/bigtable_table_admin.get_backup.js | 60 + .../v2/bigtable_table_admin.get_iam_policy.js | 64 + .../v2/bigtable_table_admin.get_snapshot.js | 60 + .../v2/bigtable_table_admin.get_table.js | 65 + .../v2/bigtable_table_admin.list_backups.js | 126 + .../v2/bigtable_table_admin.list_snapshots.js | 73 + .../v2/bigtable_table_admin.list_tables.js | 80 + ...able_table_admin.modify_column_families.js | 68 + .../v2/bigtable_table_admin.restore_table.js | 74 + .../v2/bigtable_table_admin.set_iam_policy.js | 67 + .../v2/bigtable_table_admin.snapshot_table.js | 87 + ...gtable_table_admin.test_iam_permissions.js | 67 + .../v2/bigtable_table_admin.update_backup.js | 70 + ...pet_metadata.google.bigtable.admin.v2.json | 1999 ++++++++++ owl-bot-staging/admin/v2/src/index.ts | 27 + .../src/v2/bigtable_instance_admin_client.ts | 2869 +++++++++++++++ ...bigtable_instance_admin_client_config.json | 140 + .../bigtable_instance_admin_proto_list.json | 7 + .../v2/src/v2/bigtable_table_admin_client.ts | 3142 ++++++++++++++++ .../bigtable_table_admin_client_config.json | 143 + .../v2/bigtable_table_admin_proto_list.json | 7 + .../admin/v2/src/v2/gapic_metadata.json | 487 +++ owl-bot-staging/admin/v2/src/v2/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../admin/v2/system-test/install.ts | 49 + .../test/gapic_bigtable_instance_admin_v2.ts | 3152 ++++++++++++++++ .../v2/test/gapic_bigtable_table_admin_v2.ts | 3243 +++++++++++++++++ owl-bot-staging/admin/v2/tsconfig.json | 19 + owl-bot-staging/admin/v2/webpack.config.js | 64 + owl-bot-staging/v2/.eslintignore | 7 + owl-bot-staging/v2/.eslintrc.json | 3 + owl-bot-staging/v2/.gitignore | 14 + owl-bot-staging/v2/.jsdoc.js | 55 + owl-bot-staging/v2/.mocharc.js | 33 + owl-bot-staging/v2/.prettierrc.js | 22 + owl-bot-staging/v2/README.md | 1 + owl-bot-staging/v2/linkinator.config.json | 16 + owl-bot-staging/v2/package.json | 64 + .../protos/google/bigtable/v2/bigtable.proto | 528 +++ .../v2/protos/google/bigtable/v2/data.proto | 535 +++ .../v2/bigtable.check_and_mutate_row.js | 98 + .../generated/v2/bigtable.mutate_row.js | 81 + .../generated/v2/bigtable.mutate_rows.js | 78 + .../generated/v2/bigtable.ping_and_warm.js | 68 + .../v2/bigtable.read_modify_write_row.js | 82 + .../generated/v2/bigtable.read_rows.js | 86 + .../generated/v2/bigtable.sample_row_keys.js | 71 + .../snippet_metadata.google.bigtable.v2.json | 371 ++ owl-bot-staging/v2/src/index.ts | 25 + owl-bot-staging/v2/src/v2/bigtable_client.ts | 925 +++++ .../v2/src/v2/bigtable_client_config.json | 69 + .../v2/src/v2/bigtable_proto_list.json | 4 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 78 + owl-bot-staging/v2/src/v2/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v2/system-test/install.ts | 49 + owl-bot-staging/v2/test/gapic_bigtable_v2.ts | 866 +++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 + 105 files changed, 25579 insertions(+) create mode 100644 owl-bot-staging/admin/v2/.eslintignore create mode 100644 owl-bot-staging/admin/v2/.eslintrc.json create mode 100644 owl-bot-staging/admin/v2/.gitignore create mode 100644 owl-bot-staging/admin/v2/.jsdoc.js create mode 100644 owl-bot-staging/admin/v2/.mocharc.js create mode 100644 owl-bot-staging/admin/v2/.prettierrc.js create mode 100644 owl-bot-staging/admin/v2/README.md create mode 100644 owl-bot-staging/admin/v2/linkinator.config.json create mode 100644 owl-bot-staging/admin/v2/package.json create mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto create mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto create mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto create mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto create mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js create mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json create mode 100644 owl-bot-staging/admin/v2/src/index.ts create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json create mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json create mode 100644 owl-bot-staging/admin/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/admin/v2/src/v2/index.ts create mode 100644 owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/admin/v2/system-test/install.ts create mode 100644 owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts create mode 100644 owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts create mode 100644 owl-bot-staging/admin/v2/tsconfig.json create mode 100644 owl-bot-staging/admin/v2/webpack.config.js create mode 100644 owl-bot-staging/v2/.eslintignore create mode 100644 owl-bot-staging/v2/.eslintrc.json create mode 100644 owl-bot-staging/v2/.gitignore create mode 100644 owl-bot-staging/v2/.jsdoc.js create mode 100644 owl-bot-staging/v2/.mocharc.js create mode 100644 owl-bot-staging/v2/.prettierrc.js create mode 100644 owl-bot-staging/v2/README.md create mode 100644 owl-bot-staging/v2/linkinator.config.json create mode 100644 owl-bot-staging/v2/package.json create mode 100644 owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto create mode 100644 owl-bot-staging/v2/protos/google/bigtable/v2/data.proto create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js create mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json create mode 100644 owl-bot-staging/v2/src/index.ts create mode 100644 owl-bot-staging/v2/src/v2/bigtable_client.ts create mode 100644 owl-bot-staging/v2/src/v2/bigtable_client_config.json create mode 100644 owl-bot-staging/v2/src/v2/bigtable_proto_list.json create mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/v2/src/v2/index.ts create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v2/system-test/install.ts create mode 100644 owl-bot-staging/v2/test/gapic_bigtable_v2.ts create mode 100644 owl-bot-staging/v2/tsconfig.json create mode 100644 owl-bot-staging/v2/webpack.config.js diff --git a/owl-bot-staging/admin/v2/.eslintignore b/owl-bot-staging/admin/v2/.eslintignore new file mode 100644 index 000000000..cfc348ec4 --- /dev/null +++ b/owl-bot-staging/admin/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/admin/v2/.eslintrc.json b/owl-bot-staging/admin/v2/.eslintrc.json new file mode 100644 index 000000000..782153495 --- /dev/null +++ b/owl-bot-staging/admin/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/admin/v2/.gitignore b/owl-bot-staging/admin/v2/.gitignore new file mode 100644 index 000000000..5d32b2378 --- /dev/null +++ b/owl-bot-staging/admin/v2/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/admin/v2/.jsdoc.js b/owl-bot-staging/admin/v2/.jsdoc.js new file mode 100644 index 000000000..7cb0f52a2 --- /dev/null +++ b/owl-bot-staging/admin/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/bigtable', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/admin/v2/.mocharc.js b/owl-bot-staging/admin/v2/.mocharc.js new file mode 100644 index 000000000..481c522b0 --- /dev/null +++ b/owl-bot-staging/admin/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/admin/v2/.prettierrc.js b/owl-bot-staging/admin/v2/.prettierrc.js new file mode 100644 index 000000000..494e14786 --- /dev/null +++ b/owl-bot-staging/admin/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/admin/v2/README.md b/owl-bot-staging/admin/v2/README.md new file mode 100644 index 000000000..5d45b74ed --- /dev/null +++ b/owl-bot-staging/admin/v2/README.md @@ -0,0 +1 @@ +Admin: Nodejs Client diff --git a/owl-bot-staging/admin/v2/linkinator.config.json b/owl-bot-staging/admin/v2/linkinator.config.json new file mode 100644 index 000000000..befd23c86 --- /dev/null +++ b/owl-bot-staging/admin/v2/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/admin/v2/package.json b/owl-bot-staging/admin/v2/package.json new file mode 100644 index 000000000..6da83a9f9 --- /dev/null +++ b/owl-bot-staging/admin/v2/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/bigtable", + "version": "0.1.0", + "description": "Admin client for Node.js", + "repository": "googleapis/nodejs-admin", + "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 admin", + "admin", + "bigtable instance admin", + "bigtable table admin" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto new file mode 100644 index 000000000..6dfc0e2a9 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -0,0 +1,698 @@ +// 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.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/bigtable/admin/v2/instance.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "BigtableInstanceAdminProto"; +option java_package = "com.google.bigtable.admin.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; +option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; + +// Service for creating, configuring, and deleting Cloud Bigtable Instances and +// Clusters. Provides access to the Instance and Cluster schemas only, not the +// tables' metadata or data stored in those tables. +service BigtableInstanceAdmin { + option (google.api.default_host) = "bigtableadmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/bigtable.admin," + "https://www.googleapis.com/auth/bigtable.admin.cluster," + "https://www.googleapis.com/auth/bigtable.admin.instance," + "https://www.googleapis.com/auth/cloud-bigtable.admin," + "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster," + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Create an instance within a project. + // + // Note that exactly one of Cluster.serve_nodes and + // Cluster.cluster_config.cluster_autoscaling_config can be set. If + // serve_nodes is set to non-zero, then the cluster is manually scaled. If + // cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + // enabled. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/instances" + body: "*" + }; + option (google.api.method_signature) = "parent,instance_id,instance,clusters"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "CreateInstanceMetadata" + }; + } + + // Gets information about an instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists information about instances in a project. + rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/instances" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an instance within a project. This method updates only the display + // name and type for an Instance. To update other Instance properties, such as + // labels, use PartialUpdateInstance. + rpc UpdateInstance(Instance) returns (Instance) { + option (google.api.http) = { + put: "/v2/{name=projects/*/instances/*}" + body: "*" + }; + } + + // Partially updates an instance within a project. This method can modify all + // fields of an Instance and is the preferred way to update an Instance. + rpc PartialUpdateInstance(PartialUpdateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{instance.name=projects/*/instances/*}" + body: "instance" + }; + option (google.api.method_signature) = "instance,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "UpdateInstanceMetadata" + }; + } + + // Delete an instance from a project. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a cluster within an instance. + // + // Note that exactly one of Cluster.serve_nodes and + // Cluster.cluster_config.cluster_autoscaling_config can be set. If + // serve_nodes is set to non-zero, then the cluster is manually scaled. If + // cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + // enabled. + rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*}/clusters" + body: "cluster" + }; + option (google.api.method_signature) = "parent,cluster_id,cluster"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "CreateClusterMetadata" + }; + } + + // Gets information about a cluster. + rpc GetCluster(GetClusterRequest) returns (Cluster) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*/clusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists information about clusters in an instance. + rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*}/clusters" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a cluster within an instance. + // + // Note that UpdateCluster does not support updating + // cluster_config.cluster_autoscaling_config. In order to update it, you + // must use PartialUpdateCluster. + rpc UpdateCluster(Cluster) returns (google.longrunning.Operation) { + option (google.api.http) = { + put: "/v2/{name=projects/*/instances/*/clusters/*}" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "UpdateClusterMetadata" + }; + } + + // Partially updates a cluster within a project. This method is the preferred + // way to update a Cluster. + // + // To enable and update autoscaling, set + // cluster_config.cluster_autoscaling_config. When autoscaling is enabled, + // serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it + // are ignored. Note that an update cannot simultaneously set serve_nodes to + // non-zero and cluster_config.cluster_autoscaling_config to non-empty, and + // also specify both in the update_mask. + // + // To disable autoscaling, clear cluster_config.cluster_autoscaling_config, + // and explicitly set a serve_node count via the update_mask. + rpc PartialUpdateCluster(PartialUpdateClusterRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{cluster.name=projects/*/instances/*/clusters/*}" + body: "cluster" + }; + option (google.api.method_signature) = "cluster,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Cluster" + metadata_type: "PartialUpdateClusterMetadata" + }; + } + + // Deletes a cluster from an instance. + rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*/clusters/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an app profile within an instance. + rpc CreateAppProfile(CreateAppProfileRequest) returns (AppProfile) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*}/appProfiles" + body: "app_profile" + }; + option (google.api.method_signature) = "parent,app_profile_id,app_profile"; + } + + // Gets information about an app profile. + rpc GetAppProfile(GetAppProfileRequest) returns (AppProfile) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*/appProfiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists information about app profiles in an instance. + rpc ListAppProfiles(ListAppProfilesRequest) returns (ListAppProfilesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*}/appProfiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an app profile within an instance. + rpc UpdateAppProfile(UpdateAppProfileRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}" + body: "app_profile" + }; + option (google.api.method_signature) = "app_profile,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "AppProfile" + metadata_type: "UpdateAppProfileMetadata" + }; + } + + // Deletes an app profile from an instance. + rpc DeleteAppProfile(DeleteAppProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*/appProfiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the access control policy for an instance resource. Returns an empty + // policy if an instance exists but does not have a policy set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Sets the access control policy on an instance resource. Replaces any + // existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns permissions that the caller has on the specified instance resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Lists hot tablets in a cluster, within the time range provided. Hot + // tablets are ordered based on CPU usage. + rpc ListHotTablets(ListHotTabletsRequest) returns (ListHotTabletsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for BigtableInstanceAdmin.CreateInstance. +message CreateInstanceRequest { + // Required. The unique name of the project in which to create the new instance. + // Values are of the form `projects/{project}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The ID to be used when referring to the new instance within its project, + // e.g., just `myinstance` rather than + // `projects/myproject/instances/myinstance`. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The instance to create. + // Fields marked `OutputOnly` must be left blank. + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The clusters to be created within the instance, mapped by desired + // cluster ID, e.g., just `mycluster` rather than + // `projects/myproject/instances/myinstance/clusters/mycluster`. + // Fields marked `OutputOnly` must be left blank. + // Currently, at most four clusters can be specified. + map clusters = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BigtableInstanceAdmin.GetInstance. +message GetInstanceRequest { + // Required. The unique name of the requested instance. Values are of the form + // `projects/{project}/instances/{instance}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; +} + +// Request message for BigtableInstanceAdmin.ListInstances. +message ListInstancesRequest { + // Required. The unique name of the project for which a list of instances is requested. + // Values are of the form `projects/{project}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // DEPRECATED: This field is unused and ignored. + string page_token = 2; +} + +// Response message for BigtableInstanceAdmin.ListInstances. +message ListInstancesResponse { + // The list of requested instances. + repeated Instance instances = 1; + + // Locations from which Instance information could not be retrieved, + // due to an outage or some other transient condition. + // Instances whose Clusters are all in one of the failed locations + // may be missing from `instances`, and Instances with at least one + // Cluster in a failed location may only have partial information returned. + // Values are of the form `projects//locations/` + repeated string failed_locations = 2; + + // DEPRECATED: This field is unused and ignored. + string next_page_token = 3; +} + +// Request message for BigtableInstanceAdmin.PartialUpdateInstance. +message PartialUpdateInstanceRequest { + // Required. The Instance which will (partially) replace the current value. + Instance instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The subset of Instance fields which should be replaced. + // Must be explicitly set. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BigtableInstanceAdmin.DeleteInstance. +message DeleteInstanceRequest { + // Required. The unique name of the instance to be deleted. + // Values are of the form `projects/{project}/instances/{instance}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; +} + +// Request message for BigtableInstanceAdmin.CreateCluster. +message CreateClusterRequest { + // Required. The unique name of the instance in which to create the new cluster. + // Values are of the form + // `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The ID to be used when referring to the new cluster within its instance, + // e.g., just `mycluster` rather than + // `projects/myproject/instances/myinstance/clusters/mycluster`. + string cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The cluster to be created. + // Fields marked `OutputOnly` must be left blank. + Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BigtableInstanceAdmin.GetCluster. +message GetClusterRequest { + // Required. The unique name of the requested cluster. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; +} + +// Request message for BigtableInstanceAdmin.ListClusters. +message ListClustersRequest { + // Required. The unique name of the instance for which a list of clusters is requested. + // Values are of the form `projects/{project}/instances/{instance}`. + // Use `{instance} = '-'` to list Clusters for all Instances in a project, + // e.g., `projects/myproject/instances/-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // DEPRECATED: This field is unused and ignored. + string page_token = 2; +} + +// Response message for BigtableInstanceAdmin.ListClusters. +message ListClustersResponse { + // The list of requested clusters. + repeated Cluster clusters = 1; + + // Locations from which Cluster information could not be retrieved, + // due to an outage or some other transient condition. + // Clusters from these locations may be missing from `clusters`, + // or may only have partial information returned. + // Values are of the form `projects//locations/` + repeated string failed_locations = 2; + + // DEPRECATED: This field is unused and ignored. + string next_page_token = 3; +} + +// Request message for BigtableInstanceAdmin.DeleteCluster. +message DeleteClusterRequest { + // Required. The unique name of the cluster to be deleted. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; +} + +// The metadata for the Operation returned by CreateInstance. +message CreateInstanceMetadata { + // The request that prompted the initiation of this CreateInstance operation. + CreateInstanceRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by UpdateInstance. +message UpdateInstanceMetadata { + // The request that prompted the initiation of this UpdateInstance operation. + PartialUpdateInstanceRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by CreateCluster. +message CreateClusterMetadata { + // The request that prompted the initiation of this CreateCluster operation. + CreateClusterRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by UpdateCluster. +message UpdateClusterMetadata { + // The request that prompted the initiation of this UpdateCluster operation. + Cluster original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by PartialUpdateCluster. +message PartialUpdateClusterMetadata { + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 1; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 2; + + // The original request for PartialUpdateCluster. + PartialUpdateClusterRequest original_request = 3; +} + +// Request message for BigtableInstanceAdmin.PartialUpdateCluster. +message PartialUpdateClusterRequest { + // Required. The Cluster which contains the partial updates to be applied, subject to + // the update_mask. + Cluster cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The subset of Cluster fields which should be replaced. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BigtableInstanceAdmin.CreateAppProfile. +message CreateAppProfileRequest { + // Required. The unique name of the instance in which to create the new app profile. + // Values are of the form + // `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The ID to be used when referring to the new app profile within its + // instance, e.g., just `myprofile` rather than + // `projects/myproject/instances/myinstance/appProfiles/myprofile`. + string app_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The app profile to be created. + // Fields marked `OutputOnly` will be ignored. + AppProfile app_profile = 3 [(google.api.field_behavior) = REQUIRED]; + + // If true, ignore safety checks when creating the app profile. + bool ignore_warnings = 4; +} + +// Request message for BigtableInstanceAdmin.GetAppProfile. +message GetAppProfileRequest { + // Required. The unique name of the requested app profile. Values are of the form + // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/AppProfile" + } + ]; +} + +// Request message for BigtableInstanceAdmin.ListAppProfiles. +message ListAppProfilesRequest { + // Required. The unique name of the instance for which a list of app profiles is + // requested. Values are of the form + // `projects/{project}/instances/{instance}`. + // Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + // e.g., `projects/myproject/instances/-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Maximum number of results per page. + // + // A page_size of zero lets the server choose the number of items to return. + // A page_size which is strictly positive will return at most that many items. + // A negative page_size will cause an error. + // + // Following the first request, subsequent paginated calls are not required + // to pass a page_size. If a page_size is set in subsequent calls, it must + // match the page_size given in the first request. + int32 page_size = 3; + + // The value of `next_page_token` returned by a previous call. + string page_token = 2; +} + +// Response message for BigtableInstanceAdmin.ListAppProfiles. +message ListAppProfilesResponse { + // The list of requested app profiles. + repeated AppProfile app_profiles = 1; + + // Set if not all app profiles could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; + + // Locations from which AppProfile information could not be retrieved, + // due to an outage or some other transient condition. + // AppProfiles from these locations may be missing from `app_profiles`. + // Values are of the form `projects//locations/` + repeated string failed_locations = 3; +} + +// Request message for BigtableInstanceAdmin.UpdateAppProfile. +message UpdateAppProfileRequest { + // Required. The app profile which will (partially) replace the current value. + AppProfile app_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The subset of app profile fields which should be replaced. + // If unset, all fields will be replaced. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // If true, ignore safety checks when updating the app profile. + bool ignore_warnings = 3; +} + +// Request message for BigtableInstanceAdmin.DeleteAppProfile. +message DeleteAppProfileRequest { + // Required. The unique name of the app profile to be deleted. Values are of the form + // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/AppProfile" + } + ]; + + // Required. If true, ignore safety checks when deleting the app profile. + bool ignore_warnings = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The metadata for the Operation returned by UpdateAppProfile. +message UpdateAppProfileMetadata { + +} + +// Request message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsRequest { + // Required. The cluster name to list hot tablets. + // Value is in the following form: + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // The start time to list hot tablets. The hot tablets in the response will + // have start times between the requested start time and end time. Start time + // defaults to Now if it is unset, and end time defaults to Now - 24 hours if + // it is unset. The start time should be less than the end time, and the + // maximum allowed time range between start time and end time is 48 hours. + // Start time and end time should have values between Now and Now - 14 days. + google.protobuf.Timestamp start_time = 2; + + // The end time to list hot tablets. + google.protobuf.Timestamp end_time = 3; + + // Maximum number of results per page. + // + // A page_size that is empty or zero lets the server choose the number of + // items to return. A page_size which is strictly positive will return at most + // that many items. A negative page_size will cause an error. + // + // Following the first request, subsequent paginated calls do not need a + // page_size field. If a page_size is set in subsequent calls, it must match + // the page_size given in the first request. + int32 page_size = 4; + + // The value of `next_page_token` returned by a previous call. + string page_token = 5; +} + +// Response message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsResponse { + // List of hot tablets in the tables of the requested cluster that fall + // within the requested time range. Hot tablets are ordered by node cpu usage + // percent. If there are multiple hot tablets that correspond to the same + // tablet within a 15-minute interval, only the hot tablet with the highest + // node cpu usage will be included in the response. + repeated HotTablet hot_tablets = 1; + + // Set if not all hot tablets could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto new file mode 100644 index 000000000..88bd87047 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto @@ -0,0 +1,1003 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.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.bigtable.admin.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/bigtable/admin/v2/common.proto"; +import "google/bigtable/admin/v2/table.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "BigtableTableAdminProto"; +option java_package = "com.google.bigtable.admin.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; +option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; + +// Service for creating, configuring, and deleting Cloud Bigtable tables. +// +// +// Provides access to the table schemas only, not the data stored within +// the tables. +service BigtableTableAdmin { + option (google.api.default_host) = "bigtableadmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/bigtable.admin," + "https://www.googleapis.com/auth/bigtable.admin.table," + "https://www.googleapis.com/auth/cloud-bigtable.admin," + "https://www.googleapis.com/auth/cloud-bigtable.admin.table," + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Creates a new table in the specified instance. + // The table can be created with a full set of initial column families, + // specified in the request. + rpc CreateTable(CreateTableRequest) returns (Table) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*}/tables" + body: "*" + }; + option (google.api.method_signature) = "parent,table_id,table"; + } + + // Creates a new table from the specified snapshot. The target table must + // not exist. The snapshot and the table must be in the same instance. + // + // Note: This is a private alpha release of Cloud Bigtable snapshots. This + // feature is not currently available to most Cloud Bigtable customers. This + // feature might be changed in backward-incompatible ways and is not + // recommended for production use. It is not subject to any SLA or deprecation + // policy. + rpc CreateTableFromSnapshot(CreateTableFromSnapshotRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot" + body: "*" + }; + option (google.api.method_signature) = "parent,table_id,source_snapshot"; + option (google.longrunning.operation_info) = { + response_type: "Table" + metadata_type: "CreateTableFromSnapshotMetadata" + }; + } + + // Lists all tables served from a specified instance. + rpc ListTables(ListTablesRequest) returns (ListTablesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*}/tables" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets metadata information about the specified table. + rpc GetTable(GetTableRequest) returns (Table) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*/tables/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Permanently deletes a specified table and all of its data. + rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*/tables/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Performs a series of column family modifications on the specified table. + // Either all or none of the modifications will occur before this method + // returns, but data requests received prior to that point may see a table + // where only some modifications have taken effect. + rpc ModifyColumnFamilies(ModifyColumnFamiliesRequest) returns (Table) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies" + body: "*" + }; + option (google.api.method_signature) = "name,modifications"; + } + + // Permanently drop/delete a row range from a specified table. The request can + // specify whether to delete all rows in a table, or only those that match a + // particular prefix. + rpc DropRowRange(DropRowRangeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:dropRowRange" + body: "*" + }; + } + + // Generates a consistency token for a Table, which can be used in + // CheckConsistency to check whether mutations to the table that finished + // before this call started have been replicated. The tokens will be available + // for 90 days. + rpc GenerateConsistencyToken(GenerateConsistencyTokenRequest) returns (GenerateConsistencyTokenResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Checks replication consistency based on a consistency token, that is, if + // replication has caught up based on the conditions specified in the token + // and the check request. + rpc CheckConsistency(CheckConsistencyRequest) returns (CheckConsistencyResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:checkConsistency" + body: "*" + }; + option (google.api.method_signature) = "name,consistency_token"; + } + + // Creates a new snapshot in the specified cluster from the specified + // source table. The cluster and the table must be in the same instance. + // + // Note: This is a private alpha release of Cloud Bigtable snapshots. This + // feature is not currently available to most Cloud Bigtable customers. This + // feature might be changed in backward-incompatible ways and is not + // recommended for production use. It is not subject to any SLA or deprecation + // policy. + rpc SnapshotTable(SnapshotTableRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*/tables/*}:snapshot" + body: "*" + }; + option (google.api.method_signature) = "name,cluster,snapshot_id,description"; + option (google.longrunning.operation_info) = { + response_type: "Snapshot" + metadata_type: "SnapshotTableMetadata" + }; + } + + // Gets metadata information about the specified snapshot. + // + // Note: This is a private alpha release of Cloud Bigtable snapshots. This + // feature is not currently available to most Cloud Bigtable customers. This + // feature might be changed in backward-incompatible ways and is not + // recommended for production use. It is not subject to any SLA or deprecation + // policy. + rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all snapshots associated with the specified cluster. + // + // Note: This is a private alpha release of Cloud Bigtable snapshots. This + // feature is not currently available to most Cloud Bigtable customers. This + // feature might be changed in backward-incompatible ways and is not + // recommended for production use. It is not subject to any SLA or deprecation + // policy. + rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*/clusters/*}/snapshots" + }; + option (google.api.method_signature) = "parent"; + } + + // Permanently deletes the specified snapshot. + // + // Note: This is a private alpha release of Cloud Bigtable snapshots. This + // feature is not currently available to most Cloud Bigtable customers. This + // feature might be changed in backward-incompatible ways and is not + // recommended for production use. It is not subject to any SLA or deprecation + // policy. + rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Starts creating a new Cloud Bigtable Backup. The returned backup + // [long-running operation][google.longrunning.Operation] can be used to + // track creation of the backup. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The + // [response][google.longrunning.Operation.response] field type is + // [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the + // creation and delete the backup. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*/clusters/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup_id,backup"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "CreateBackupMetadata" + }; + } + + // Gets metadata on a pending or completed Cloud Bigtable Backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a pending or completed Cloud Bigtable Backup. + rpc UpdateBackup(UpdateBackupRequest) returns (Backup) { + option (google.api.http) = { + patch: "/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup,update_mask"; + } + + // Deletes a pending or completed Cloud Bigtable backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Cloud Bigtable backups. Returns both completed and pending + // backups. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*/clusters/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new table by restoring from a completed backup. The new table + // must be in the same project as the instance containing the backup. The + // returned table [long-running operation][google.longrunning.Operation] can + // be used to track the progress of the operation, and to cancel it. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The + // [response][google.longrunning.Operation.response] type is + // [Table][google.bigtable.admin.v2.Table], if successful. + rpc RestoreTable(RestoreTableRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/instances/*}/tables:restore" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Table" + metadata_type: "RestoreTableMetadata" + }; + } + + // Gets the access control policy for a Table or Backup resource. + // Returns an empty policy if the resource exists but does not have a policy + // set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:getIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource"; + } + + // Sets the access control policy on a Table or Backup resource. + // Replaces any existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:setIamPolicy" + body: "*" + } + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns permissions that the caller has on the specified Table or Backup resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:testIamPermissions" + body: "*" + } + }; + option (google.api.method_signature) = "resource,permissions"; + } +} + +// The request for +// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable]. +message RestoreTableRequest { + // Required. The name of the instance in which to create the restored + // table. This instance must be in the same project as the source backup. + // Values are of the form `projects//instances/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The id of the table to create and restore to. This + // table must not already exist. The `table_id` appended to + // `parent` forms the full table name of the form + // `projects//instances//tables/`. + string table_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The source from which to restore. + oneof source { + // Name of the backup from which to restore. Values are of the form + // `projects//instances//clusters//backups/`. + string backup = 3 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + }]; + } +} + +// Metadata type for the long-running operation returned by +// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable]. +message RestoreTableMetadata { + // Name of the table being created and restored to. + string name = 1; + + // The type of the restore source. + RestoreSourceType source_type = 2; + + // Information about the source used to restore the table, as specified by + // `source` in [RestoreTableRequest][google.bigtable.admin.v2.RestoreTableRequest]. + oneof source_info { + BackupInfo backup_info = 3; + } + + // If exists, the name of the long-running operation that will be used to + // track the post-restore optimization process to optimize the performance of + // the restored table. The metadata type of the long-running operation is + // [OptimizeRestoreTableMetadata][]. The response type is + // [Empty][google.protobuf.Empty]. This long-running operation may be + // automatically created by the system if applicable after the + // RestoreTable long-running operation completes successfully. This operation + // may not be created if the table is already optimized or the restore was + // not successful. + string optimize_table_operation_name = 4; + + // The progress of the [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable] + // operation. + OperationProgress progress = 5; +} + +// Metadata type for the long-running operation used to track the progress +// of optimizations performed on a newly restored table. This long-running +// operation is automatically created by the system after the successful +// completion of a table restore, and cannot be cancelled. +message OptimizeRestoredTableMetadata { + // Name of the restored table being optimized. + string name = 1; + + // The progress of the post-restore optimizations. + OperationProgress progress = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable] +message CreateTableRequest { + // An initial split point for a newly created table. + message Split { + // Row key to use as an initial tablet boundary. + bytes key = 1; + } + + // Required. The unique name of the instance in which to create the table. + // Values are of the form `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The name by which the new table should be referred to within the parent + // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + // Maximum 50 characters. + string table_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Table to create. + Table table = 3 [(google.api.field_behavior) = REQUIRED]; + + // The optional list of row keys that will be used to initially split the + // table into several tablets (tablets are similar to HBase regions). + // Given two split keys, `s1` and `s2`, three tablets will be created, + // spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + // + // Example: + // + // * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + // `"other", "zz"]` + // * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + // * Key assignment: + // - Tablet 1 `[, apple) => {"a"}.` + // - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + // - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + // - Tablet 4 `[customer_2, other) => {"customer_2"}.` + // - Tablet 5 `[other, ) => {"other", "zz"}.` + repeated Split initial_splits = 4; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message CreateTableFromSnapshotRequest { + // Required. The unique name of the instance in which to create the table. + // Values are of the form `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // Required. The name by which the new table should be referred to within the parent + // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + string table_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique name of the snapshot from which to restore the table. The + // snapshot and the table must be in the same instance. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + string source_snapshot = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Snapshot" + } + ]; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange] +message DropRowRangeRequest { + // Required. The unique name of the table on which to drop a range of rows. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // Delete all rows or by prefix. + oneof target { + // Delete all rows that start with this row key prefix. Prefix cannot be + // zero length. + bytes row_key_prefix = 2; + + // Delete all rows in the table. Setting this to false is a no-op. + bool delete_all_data_from_table = 3; + } +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] +message ListTablesRequest { + // Required. The unique name of the instance for which tables should be listed. + // Values are of the form `projects/{project}/instances/{instance}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // The view to be applied to the returned tables' fields. + // Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + Table.View view = 2; + + // Maximum number of results per page. + // + // A page_size of zero lets the server choose the number of items to return. + // A page_size which is strictly positive will return at most that many items. + // A negative page_size will cause an error. + // + // Following the first request, subsequent paginated calls are not required + // to pass a page_size. If a page_size is set in subsequent calls, it must + // match the page_size given in the first request. + int32 page_size = 4; + + // The value of `next_page_token` returned by a previous call. + string page_token = 3; +} + +// Response message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] +message ListTablesResponse { + // The tables present in the requested instance. + repeated Table tables = 1; + + // Set if not all tables could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable] +message GetTableRequest { + // Required. The unique name of the requested table. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // The view to be applied to the returned table's fields. + // Defaults to `SCHEMA_VIEW` if unspecified. + Table.View view = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable] +message DeleteTableRequest { + // Required. The unique name of the table to be deleted. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies] +message ModifyColumnFamiliesRequest { + // A create, update, or delete of a particular column family. + message Modification { + // The ID of the column family to be modified. + string id = 1; + + // Column familiy modifications. + oneof mod { + // Create a new column family with the specified schema, or fail if + // one already exists with the given ID. + ColumnFamily create = 2; + + // Update an existing column family to the specified schema, or fail + // if no column family exists with the given ID. + ColumnFamily update = 3; + + // Drop (delete) the column family with the given ID, or fail if no such + // family exists. + bool drop = 4; + } + } + + // Required. The unique name of the table whose families should be modified. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // Required. Modifications to be atomically applied to the specified table's families. + // Entries are applied in order, meaning that earlier modifications can be + // masked by later ones (in the case of repeated updates to the same family, + // for example). + repeated Modification modifications = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken] +message GenerateConsistencyTokenRequest { + // Required. The unique name of the Table for which to create a consistency token. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; +} + +// Response message for +// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken] +message GenerateConsistencyTokenResponse { + // The generated consistency token. + string consistency_token = 1; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency] +message CheckConsistencyRequest { + // Required. The unique name of the Table for which to check replication consistency. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // Required. The token created using GenerateConsistencyToken for the Table. + string consistency_token = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for +// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency] +message CheckConsistencyResponse { + // True only if the token is consistent. A token is consistent if replication + // has caught up with the restrictions specified in the request. + bool consistent = 1; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message SnapshotTableRequest { + // Required. The unique name of the table to have the snapshot taken. + // Values are of the form + // `projects/{project}/instances/{instance}/tables/{table}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // Required. The name of the cluster where the snapshot will be created in. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string cluster = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // Required. The ID by which the new snapshot should be referred to within the parent + // cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` + // rather than + // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + string snapshot_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // The amount of time that the new snapshot can stay active after it is + // created. Once 'ttl' expires, the snapshot will get deleted. The maximum + // amount of time a snapshot can stay active is 7 days. If 'ttl' is not + // specified, the default value of 24 hours will be used. + google.protobuf.Duration ttl = 4; + + // Description of the snapshot. + string description = 5; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message GetSnapshotRequest { + // Required. The unique name of the requested snapshot. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Snapshot" + } + ]; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message ListSnapshotsRequest { + // Required. The unique name of the cluster for which snapshots should be listed. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + // Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + // e.g., `projects/{project}/instances/{instance}/clusters/-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // The maximum number of snapshots to return per page. + // CURRENTLY UNIMPLEMENTED AND IGNORED. + int32 page_size = 2; + + // The value of `next_page_token` returned by a previous call. + string page_token = 3; +} + +// Response message for +// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message ListSnapshotsResponse { + // The snapshots present in the requested cluster. + repeated Snapshot snapshots = 1; + + // Set if not all snapshots could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} + +// Request message for +// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot] +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message DeleteSnapshotRequest { + // Required. The unique name of the snapshot to be deleted. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Snapshot" + } + ]; +} + +// The metadata for the Operation returned by SnapshotTable. +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message SnapshotTableMetadata { + // The request that prompted the initiation of this SnapshotTable operation. + SnapshotTableRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The metadata for the Operation returned by CreateTableFromSnapshot. +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message CreateTableFromSnapshotMetadata { + // The request that prompted the initiation of this CreateTableFromSnapshot + // operation. + CreateTableFromSnapshotRequest original_request = 1; + + // The time at which the original request was received. + google.protobuf.Timestamp request_time = 2; + + // The time at which the operation failed or was completed successfully. + google.protobuf.Timestamp finish_time = 3; +} + +// The request for [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. +message CreateBackupRequest { + // Required. This must be one of the clusters in the instance in which this + // table is located. The backup will be stored in this cluster. Values are + // of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // Required. The id of the backup to be created. The `backup_id` along with + // the parent `parent` are combined as {parent}/backups/{backup_id} to create + // the full backup name, of the form: + // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + // This string must be between 1 and 50 characters in length and match the + // regex [_a-zA-Z0-9][-_.a-zA-Z0-9]*. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata type for the operation returned by +// [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. +message CreateBackupMetadata { + // The name of the backup being created. + string name = 1; + + // The name of the table the backup is created from. + string source_table = 2; + + // The time at which this operation started. + google.protobuf.Timestamp start_time = 3; + + // If set, the time at which this operation finished or was cancelled. + google.protobuf.Timestamp end_time = 4; +} + +// The request for [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup]. +message UpdateBackupRequest { + // Required. The backup to update. `backup.name`, and the fields to be updated + // as specified by `update_mask` are required. Other fields are ignored. + // Update is only supported for the following fields: + // * `backup.expire_time`. + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A mask specifying which fields (e.g. `expire_time`) in the + // Backup resource should be updated. This mask is relative to the Backup + // resource, not to the request message. The field mask must always be + // specified; this prevents any future fields from being erased accidentally + // by clients that do not know about them. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup]. +message GetBackupRequest { + // Required. Name of the backup. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + } + ]; +} + +// The request for [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup]. +message DeleteBackupRequest { + // Required. Name of the backup to delete. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Backup" + } + ]; +} + +// The request for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. +message ListBackupsRequest { + // Required. The cluster to list backups from. Values are of the + // form `projects/{project}/instances/{instance}/clusters/{cluster}`. + // Use `{cluster} = '-'` to list backups for all clusters in an instance, + // e.g., `projects/{project}/instances/{instance}/clusters/-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // A filter expression that filters backups listed in the response. + // The expression must specify the field name, a comparison operator, + // and the value that you want to use for filtering. The value must be a + // string, a number, or a boolean. The comparison operator must be + // <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + // roughly synonymous with equality. Filter rules are case insensitive. + // + // The fields eligible for filtering are: + // * `name` + // * `source_table` + // * `state` + // * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + // * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + // * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + // * `size_bytes` + // + // To filter on multiple expressions, provide each separate expression within + // parentheses. By default, each expression is an AND expression. However, + // you can include AND, OR, and NOT expressions explicitly. + // + // Some examples of using filters are: + // + // * `name:"exact"` --> The backup's name is the string "exact". + // * `name:howl` --> The backup's name contains the string "howl". + // * `source_table:prod` + // --> The source_table's name contains the string "prod". + // * `state:CREATING` --> The backup is pending creation. + // * `state:READY` --> The backup is fully created and ready for use. + // * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + // --> The backup name contains the string "howl" and start_time + // of the backup is before 2018-03-28T14:50:00Z. + // * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + string filter = 2; + + // An expression for specifying the sort order of the results of the request. + // The string value should specify one or more fields in [Backup][google.bigtable.admin.v2.Backup]. The full + // syntax is described at https://aip.dev/132#ordering. + // + // Fields supported are: + // * name + // * source_table + // * expire_time + // * start_time + // * end_time + // * size_bytes + // * state + // + // For example, "start_time". The default sorting order is ascending. + // To specify descending order for the field, a suffix " desc" should + // be appended to the field name. For example, "start_time desc". + // Redundant space characters in the syntax are insigificant. + // + // If order_by is empty, results will be sorted by `start_time` in descending + // order starting from the most recently created backup. + string order_by = 3; + + // Number of backups to be returned in the response. If 0 or + // less, defaults to the server's maximum allowed page size. + int32 page_size = 4; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.bigtable.admin.v2.ListBackupsResponse.next_page_token] from a + // previous [ListBackupsResponse][google.bigtable.admin.v2.ListBackupsResponse] to the same `parent` and with the same + // `filter`. + string page_token = 5; +} + +// The response for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. +message ListBackupsResponse { + // The list of matching backups. + repeated Backup backups = 1; + + // `next_page_token` can be sent in a subsequent + // [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups] call to fetch more + // of the matching backups. + string next_page_token = 2; +} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto new file mode 100644 index 000000000..1d7782e67 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.bigtable.admin.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; +option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; + +// Storage media types for persisting Bigtable data. +enum StorageType { + // The user did not specify a storage type. + STORAGE_TYPE_UNSPECIFIED = 0; + + // Flash (SSD) storage should be used. + SSD = 1; + + // Magnetic drive (HDD) storage should be used. + HDD = 2; +} + +// Encapsulates progress related information for a Cloud Bigtable long +// running operation. +message OperationProgress { + // Percent completion of the operation. + // Values are between 0 and 100 inclusive. + int32 progress_percent = 1; + + // Time the request was received. + google.protobuf.Timestamp start_time = 2; + + // If set, the time at which this operation failed or was completed + // successfully. + google.protobuf.Timestamp end_time = 3; +} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto new file mode 100644 index 000000000..c15b91411 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto @@ -0,0 +1,333 @@ +// 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.bigtable.admin.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/bigtable/admin/v2/common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "InstanceProto"; +option java_package = "com.google.bigtable.admin.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; +option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and +// the resources that serve them. +// All tables in an instance are served from all +// [Clusters][google.bigtable.admin.v2.Cluster] in the instance. +message Instance { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/Instance" + pattern: "projects/{project}/instances/{instance}" + }; + + // Possible states of an instance. + enum State { + // The state of the instance could not be determined. + STATE_NOT_KNOWN = 0; + + // The instance has been successfully created and can serve requests + // to its tables. + READY = 1; + + // The instance is currently being created, and may be destroyed + // if the creation process encounters an error. + CREATING = 2; + } + + // The type of the instance. + enum Type { + // The type of the instance is unspecified. If set when creating an + // instance, a `PRODUCTION` instance will be created. If set when updating + // an instance, the type will be left unchanged. + TYPE_UNSPECIFIED = 0; + + // An instance meant for production use. `serve_nodes` must be set + // on the cluster. + PRODUCTION = 1; + + // The instance is meant for development and testing purposes only; it has + // no performance or uptime guarantees and is not covered by SLA. + // After a development instance is created, it can be upgraded by + // updating the instance to type `PRODUCTION`. An instance created + // as a production instance cannot be changed to a development instance. + // When creating a development instance, `serve_nodes` on the cluster must + // not be set. + DEVELOPMENT = 2; + } + + // The unique name of the instance. Values are of the form + // `projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The descriptive name for this instance as it appears in UIs. + // Can be changed at any time, but should be kept globally unique + // to avoid confusion. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // (`OutputOnly`) + // The current state of the instance. + State state = 3; + + // The type of the instance. Defaults to `PRODUCTION`. + Type type = 4; + + // Labels are a flexible and lightweight mechanism for organizing cloud + // resources into groups that reflect a customer's organizational needs and + // deployment strategies. They can be used to filter resources and aggregate + // metrics. + // + // * Label keys must be between 1 and 63 characters long and must conform to + // the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. + // * Label values must be between 0 and 63 characters long and must conform to + // the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. + // * No more than 64 labels can be associated with a given resource. + // * Keys and values must both be under 128 bytes. + map labels = 5; + + // Output only. A server-assigned timestamp representing when this Instance was created. + // For instances created before this field was added (August 2021), this value + // is `seconds: 0, nanos: 1`. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The Autoscaling targets for a Cluster. These determine the recommended nodes. +message AutoscalingTargets { + // The cpu utilization that the Autoscaler should be trying to achieve. + // This number is on a scale from 0 (no utilization) to + // 100 (total utilization). + int32 cpu_utilization_percent = 2; +} + +// Limits for the number of nodes a Cluster can autoscale up/down to. +message AutoscalingLimits { + // Required. Minimum number of nodes to scale down to. + int32 min_serve_nodes = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Maximum number of nodes to scale up to. + int32 max_serve_nodes = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A resizable group of nodes in a particular cloud location, capable +// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent +// [Instance][google.bigtable.admin.v2.Instance]. +message Cluster { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/Cluster" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}" + }; + + // Autoscaling config for a cluster. + message ClusterAutoscalingConfig { + // Required. Autoscaling limits for this cluster. + AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Autoscaling targets for this cluster. + AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Configuration for a cluster. + message ClusterConfig { + // Autoscaling configuration for this cluster. + ClusterAutoscalingConfig cluster_autoscaling_config = 1; + } + + // Cloud Key Management Service (Cloud KMS) settings for a CMEK-protected + // cluster. + message EncryptionConfig { + // Describes the Cloud KMS encryption key that will be used to protect the + // destination Bigtable cluster. The requirements for this key are: + // 1) The Cloud Bigtable service account associated with the project that + // contains this cluster must be granted the + // `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key. + // 2) Only regional keys can be used and the region of the CMEK key must + // match the region of the cluster. + // 3) All clusters within an instance must use the same CMEK key. + string kms_key_name = 1 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + } + + // Possible states of a cluster. + enum State { + // The state of the cluster could not be determined. + STATE_NOT_KNOWN = 0; + + // The cluster has been successfully created and is ready to serve requests. + READY = 1; + + // The cluster is currently being created, and may be destroyed + // if the creation process encounters an error. + // A cluster may not be able to serve requests while being created. + CREATING = 2; + + // The cluster is currently being resized, and may revert to its previous + // node count if the process encounters an error. + // A cluster is still capable of serving requests while being resized, + // but may exhibit performance as if its number of allocated nodes is + // between the starting and requested states. + RESIZING = 3; + + // The cluster has no backing nodes. The data (tables) still + // exist, but no operations can be performed on the cluster. + DISABLED = 4; + } + + // The unique name of the cluster. Values are of the form + // `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // (`CreationOnly`) + // The location where this cluster's nodes and storage reside. For best + // performance, clients should be located as close as possible to this + // cluster. Currently only zones are supported, so values should be of the + // form `projects/{project}/locations/{zone}`. + string location = 2 [(google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + }]; + + // The current state of the cluster. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The number of nodes allocated to this cluster. More nodes enable higher + // throughput and more consistent performance. + int32 serve_nodes = 4; + + oneof config { + // Configuration for this cluster. + ClusterConfig cluster_config = 7; + } + + // (`CreationOnly`) + // The type of storage used by this cluster to serve its + // parent instance's tables, unless explicitly overridden. + StorageType default_storage_type = 5; + + // Immutable. The encryption configuration for CMEK-protected clusters. + EncryptionConfig encryption_config = 6 + [(google.api.field_behavior) = IMMUTABLE]; +} + +// A configuration object describing how Cloud Bigtable should treat traffic +// from a particular end user application. +message AppProfile { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/AppProfile" + pattern: "projects/{project}/instances/{instance}/appProfiles/{app_profile}" + }; + + // Read/write requests are routed to the nearest cluster in the instance, and + // will fail over to the nearest cluster that is available in the event of + // transient errors or delays. Clusters in a region are considered + // equidistant. Choosing this option sacrifices read-your-writes consistency + // to improve availability. + message MultiClusterRoutingUseAny { + // The set of clusters to route to. The order is ignored; clusters will be + // tried in order of distance. If left empty, all clusters are eligible. + repeated string cluster_ids = 1; + } + + // Unconditionally routes all read/write requests to a specific cluster. + // This option preserves read-your-writes consistency but does not improve + // availability. + message SingleClusterRouting { + // The cluster to which read/write requests should be routed. + string cluster_id = 1; + + // Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are + // allowed by this app profile. It is unsafe to send these requests to + // the same table/row/column in multiple clusters. + bool allow_transactional_writes = 2; + } + + // (`OutputOnly`) + // The unique name of the app profile. Values are of the form + // `projects/{project}/instances/{instance}/appProfiles/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + string name = 1; + + // Strongly validated etag for optimistic concurrency control. Preserve the + // value returned from `GetAppProfile` when calling `UpdateAppProfile` to + // fail the request if there has been a modification in the mean time. The + // `update_mask` of the request need not include `etag` for this protection + // to apply. + // See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and + // [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more + // details. + string etag = 2; + + // Optional long form description of the use case for this AppProfile. + string description = 3; + + // The routing policy for all read/write requests that use this app profile. + // A value must be explicitly set. + oneof routing_policy { + // Use a multi-cluster routing policy. + MultiClusterRoutingUseAny multi_cluster_routing_use_any = 5; + + // Use a single-cluster routing policy. + SingleClusterRouting single_cluster_routing = 6; + } +} + +// A tablet is a defined by a start and end key and is explained in +// https://cloud.google.com/bigtable/docs/overview#architecture and +// https://cloud.google.com/bigtable/docs/performance#optimization. +// A Hot tablet is a tablet that exhibits high average cpu usage during the time +// interval from start time to end time. +message HotTablet { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/HotTablet" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + }; + + // The unique name of the hot tablet. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*`. + string name = 1; + + // Name of the table that contains the tablet. Values are of the form + // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + string table_name = 2 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + }]; + + // Output only. The start time of the hot tablet. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end time of the hot tablet. + google.protobuf.Timestamp end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Tablet Start Key (inclusive). + string start_key = 5; + + // Tablet End Key (inclusive). + string end_key = 6; + + // Output only. The average CPU usage spent by a node on this tablet over the start_time to + // end_time time range. The percentage is the amount of CPU used by the node + // to serve the tablet, from 0% (tablet was not interacted with) to 100% (the + // node spent all cycles serving the hot tablet). + float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto new file mode 100644 index 000000000..4e2d709ab --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto @@ -0,0 +1,405 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.bigtable.admin.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; +option java_multiple_files = true; +option java_outer_classname = "TableProto"; +option java_package = "com.google.bigtable.admin.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; +option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" +}; + +// Indicates the type of the restore source. +enum RestoreSourceType { + // No restore associated. + RESTORE_SOURCE_TYPE_UNSPECIFIED = 0; + + // A backup was used as the source of the restore. + BACKUP = 1; +} + +// Information about a table restore. +message RestoreInfo { + // The type of the restore source. + RestoreSourceType source_type = 1; + + // Information about the source used to restore the table. + oneof source_info { + // Information about the backup used to restore the table. The backup + // may no longer exist. + BackupInfo backup_info = 2; + } +} + +// A collection of user data indexed by row, column, and timestamp. +// Each table is served using the resources of its parent cluster. +message Table { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/Table" + pattern: "projects/{project}/instances/{instance}/tables/{table}" + }; + + // The state of a table's data in a particular cluster. + message ClusterState { + // Table replication states. + enum ReplicationState { + // The replication state of the table is unknown in this cluster. + STATE_NOT_KNOWN = 0; + + // The cluster was recently created, and the table must finish copying + // over pre-existing data from other clusters before it can begin + // receiving live replication updates and serving Data API requests. + INITIALIZING = 1; + + // The table is temporarily unable to serve Data API requests from this + // cluster due to planned internal maintenance. + PLANNED_MAINTENANCE = 2; + + // The table is temporarily unable to serve Data API requests from this + // cluster due to unplanned or emergency maintenance. + UNPLANNED_MAINTENANCE = 3; + + // The table can serve Data API requests from this cluster. Depending on + // replication delay, reads may not immediately reflect the state of the + // table in other clusters. + READY = 4; + + // The table is fully created and ready for use after a restore, and is + // being optimized for performance. When optimizations are complete, the + // table will transition to `READY` state. + READY_OPTIMIZING = 5; + } + + // Output only. The state of replication for the table in this cluster. + ReplicationState replication_state = 1; + + // Output only. The encryption information for the table in this cluster. + // If the encryption key protecting this resource is customer managed, then + // its version can be rotated in Cloud Key Management Service (Cloud KMS). + // The primary version of the key and its status will be reflected here when + // changes propagate from Cloud KMS. + repeated EncryptionInfo encryption_info = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Possible timestamp granularities to use when keeping multiple versions + // of data in a table. + enum TimestampGranularity { + // The user did not specify a granularity. Should not be returned. + // When specified during table creation, MILLIS will be used. + TIMESTAMP_GRANULARITY_UNSPECIFIED = 0; + + // The table keeps data versioned at a granularity of 1ms. + MILLIS = 1; + } + + // Defines a view over a table's fields. + enum View { + // Uses the default view for each method as documented in its request. + VIEW_UNSPECIFIED = 0; + + // Only populates `name`. + NAME_ONLY = 1; + + // Only populates `name` and fields related to the table's schema. + SCHEMA_VIEW = 2; + + // Only populates `name` and fields related to the table's replication + // state. + REPLICATION_VIEW = 3; + + // Only populates 'name' and fields related to the table's encryption state. + ENCRYPTION_VIEW = 5; + + // Populates all fields. + FULL = 4; + } + + // The unique name of the table. Values are of the form + // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + // Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL` + string name = 1; + + // Output only. Map from cluster ID to per-cluster table state. + // If it could not be determined whether or not the table has data in a + // particular cluster (for example, if its zone is unavailable), then + // there will be an entry for the cluster with UNKNOWN `replication_status`. + // Views: `REPLICATION_VIEW`, `ENCRYPTION_VIEW`, `FULL` + map cluster_states = 2; + + // (`CreationOnly`) + // The column families configured for this table, mapped by column family ID. + // Views: `SCHEMA_VIEW`, `FULL` + map column_families = 3; + + // (`CreationOnly`) + // The granularity (i.e. `MILLIS`) at which timestamps are stored in + // this table. Timestamps not matching the granularity will be rejected. + // If unspecified at creation time, the value will be set to `MILLIS`. + // Views: `SCHEMA_VIEW`, `FULL`. + TimestampGranularity granularity = 4; + + // Output only. If this table was restored from another data source (e.g. a + // backup), this field will be populated with information about the restore. + RestoreInfo restore_info = 6; +} + +// A set of columns within a table which share a common configuration. +message ColumnFamily { + // Garbage collection rule specified as a protobuf. + // Must serialize to at most 500 bytes. + // + // NOTE: Garbage collection executes opportunistically in the background, and + // so it's possible for reads to return a cell even if it matches the active + // GC expression for its family. + GcRule gc_rule = 1; +} + +// Rule for determining which cells to delete during garbage collection. +message GcRule { + // A GcRule which deletes cells matching all of the given rules. + message Intersection { + // Only delete cells which would be deleted by every element of `rules`. + repeated GcRule rules = 1; + } + + // A GcRule which deletes cells matching any of the given rules. + message Union { + // Delete cells which would be deleted by any element of `rules`. + repeated GcRule rules = 1; + } + + // Garbage collection rules. + oneof rule { + // Delete all cells in a column except the most recent N. + int32 max_num_versions = 1; + + // Delete cells in a column older than the given age. + // Values must be at least one millisecond, and will be truncated to + // microsecond granularity. + google.protobuf.Duration max_age = 2; + + // Delete cells that would be deleted by every nested rule. + Intersection intersection = 3; + + // Delete cells that would be deleted by any nested rule. + Union union = 4; + } +} + +// Encryption information for a given resource. +// If this resource is protected with customer managed encryption, the in-use +// Cloud Key Management Service (Cloud KMS) key version is specified along with +// its status. +message EncryptionInfo { + // Possible encryption types for a resource. + enum EncryptionType { + // Encryption type was not specified, though data at rest remains encrypted. + ENCRYPTION_TYPE_UNSPECIFIED = 0; + + // The data backing this resource is encrypted at rest with a key that is + // fully managed by Google. No key version or status will be populated. + // This is the default state. + GOOGLE_DEFAULT_ENCRYPTION = 1; + + // The data backing this resource is encrypted at rest with a key that is + // managed by the customer. + // The in-use version of the key and its status are populated for + // CMEK-protected tables. + // CMEK-protected backups are pinned to the key version that was in use at + // the time the backup was taken. This key version is populated but its + // status is not tracked and is reported as `UNKNOWN`. + CUSTOMER_MANAGED_ENCRYPTION = 2; + } + + // Output only. The type of encryption used to protect this resource. + EncryptionType encryption_type = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of encrypt/decrypt calls on underlying data for + // this resource. Regardless of status, the existing data is always encrypted + // at rest. + google.rpc.Status encryption_status = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The version of the Cloud KMS key specified in the parent + // cluster that is in use for the data underlying this table. + string kms_key_version = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// A snapshot of a table at a particular time. A snapshot can be used as a +// checkpoint for data restoration or a data source for a new table. +// +// Note: This is a private alpha release of Cloud Bigtable snapshots. This +// feature is not currently available to most Cloud Bigtable customers. This +// feature might be changed in backward-incompatible ways and is not recommended +// for production use. It is not subject to any SLA or deprecation policy. +message Snapshot { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/Snapshot" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}" + }; + + // Possible states of a snapshot. + enum State { + // The state of the snapshot could not be determined. + STATE_NOT_KNOWN = 0; + + // The snapshot has been successfully created and can serve all requests. + READY = 1; + + // The snapshot is currently being created, and may be destroyed if the + // creation process encounters an error. A snapshot may not be restored to a + // table while it is being created. + CREATING = 2; + } + + // Output only. The unique name of the snapshot. + // Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + string name = 1; + + // Output only. The source table at the time the snapshot was taken. + Table source_table = 2; + + // Output only. The size of the data in the source table at the time the + // snapshot was taken. In some cases, this value may be computed + // asynchronously via a background process and a placeholder of 0 will be used + // in the meantime. + int64 data_size_bytes = 3; + + // Output only. The time when the snapshot is created. + google.protobuf.Timestamp create_time = 4; + + // Output only. The time when the snapshot will be deleted. The maximum amount + // of time a snapshot can stay active is 365 days. If 'ttl' is not specified, + // the default maximum of 365 days will be used. + google.protobuf.Timestamp delete_time = 5; + + // Output only. The current state of the snapshot. + State state = 6; + + // Output only. Description of the snapshot. + string description = 7; +} + +// A backup of a Cloud Bigtable table. +message Backup { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/Backup" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}" + }; + + // Indicates the current state of the backup. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The pending backup is still being created. Operations on the + // backup may fail with `FAILED_PRECONDITION` in this state. + CREATING = 1; + + // The backup is complete and ready for use. + READY = 2; + } + + // Output only. A globally unique identifier for the backup which cannot be + // changed. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/ + // backups/[_a-zA-Z0-9][-_.a-zA-Z0-9]*` + // The final segment of the name must be between 1 and 50 characters + // in length. + // + // The backup is stored in the cluster identified by the prefix of the backup + // name of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. Name of the table from which this backup was created. + // This needs to be in the same instance as the backup. Values are of the form + // `projects/{project}/instances/{instance}/tables/{source_table}`. + string source_table = 2 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED + ]; + + // Required. The expiration time of the backup, with microseconds + // granularity that must be at least 6 hours and at most 30 days + // from the time the request is received. Once the `expire_time` + // has passed, Cloud Bigtable will delete the backup and free the + // resources used by the backup. + google.protobuf.Timestamp expire_time = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. `start_time` is the time that the backup was started + // (i.e. approximately the time the + // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup] + // request is received). The row data in this backup will be no older than + // this timestamp. + google.protobuf.Timestamp start_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `end_time` is the time that the backup was finished. The row + // data in the backup will be no newer than this timestamp. + google.protobuf.Timestamp end_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Size of the backup in bytes. + int64 size_bytes = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The encryption information for the backup. + EncryptionInfo encryption_info = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Information about a backup. +message BackupInfo { + // Output only. Name of the backup. + string backup = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time that the backup was started. Row data in the backup + // will be no older than this timestamp. + google.protobuf.Timestamp start_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This time that the backup was finished. Row data in the + // backup will be no newer than this timestamp. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the table the backup was created from. + string source_table = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js new file mode 100644 index 000000000..a18c932bd --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, appProfileId, appProfile) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance in which to create the new app profile. + * Values are of the form + * `projects/{project}/instances/{instance}`. + */ + // const parent = 'abc123' + /** + * Required. The ID to be used when referring to the new app profile within its + * instance, e.g., just `myprofile` rather than + * `projects/myproject/instances/myinstance/appProfiles/myprofile`. + */ + // const appProfileId = 'abc123' + /** + * Required. The app profile to be created. + * Fields marked `OutputOnly` will be ignored. + */ + // const appProfile = {} + /** + * If true, ignore safety checks when creating the app profile. + */ + // const ignoreWarnings = true + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callCreateAppProfile() { + // Construct request + const request = { + parent, + appProfileId, + appProfile, + }; + + // Run request + const response = await adminClient.createAppProfile(request); + console.log(response); + } + + callCreateAppProfile(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js new file mode 100644 index 000000000..14aba24d0 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, clusterId, cluster) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance in which to create the new cluster. + * Values are of the form + * `projects/{project}/instances/{instance}`. + */ + // const parent = 'abc123' + /** + * Required. The ID to be used when referring to the new cluster within its instance, + * e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + */ + // const clusterId = 'abc123' + /** + * Required. The cluster to be created. + * Fields marked `OutputOnly` must be left blank. + */ + // const cluster = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callCreateCluster() { + // Construct request + const request = { + parent, + clusterId, + cluster, + }; + + // Run request + const [operation] = await adminClient.createCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateCluster(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js new file mode 100644 index 000000000..80125b099 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, instanceId, instance, clusters) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the project in which to create the new instance. + * Values are of the form `projects/{project}`. + */ + // const parent = 'abc123' + /** + * Required. The ID to be used when referring to the new instance within its project, + * e.g., just `myinstance` rather than + * `projects/myproject/instances/myinstance`. + */ + // const instanceId = 'abc123' + /** + * Required. The instance to create. + * Fields marked `OutputOnly` must be left blank. + */ + // const instance = {} + /** + * Required. The clusters to be created within the instance, mapped by desired + * cluster ID, e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + * Fields marked `OutputOnly` must be left blank. + * Currently, at most four clusters can be specified. + */ + // const clusters = 1234 + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + clusters, + }; + + // Run request + const [operation] = await adminClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js new file mode 100644 index 000000000..5074cabf1 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, ignoreWarnings) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the app profile to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + */ + // const name = 'abc123' + /** + * Required. If true, ignore safety checks when deleting the app profile. + */ + // const ignoreWarnings = true + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callDeleteAppProfile() { + // Construct request + const request = { + name, + ignoreWarnings, + }; + + // Run request + const response = await adminClient.deleteAppProfile(request); + console.log(response); + } + + callDeleteAppProfile(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js new file mode 100644 index 000000000..e66fba3b3 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the cluster to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callDeleteCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteCluster(request); + console.log(response); + } + + callDeleteCluster(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js new file mode 100644 index 000000000..71cc7487f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance to be deleted. + * Values are of the form `projects/{project}/instances/{instance}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteInstance(request); + console.log(response); + } + + callDeleteInstance(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js new file mode 100644 index 000000000..f5bb4df4b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the requested app profile. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callGetAppProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getAppProfile(request); + console.log(response); + } + + callGetAppProfile(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js new file mode 100644 index 000000000..da86f66dc --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the requested cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callGetCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getCluster(request); + console.log(response); + } + + callGetCluster(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js new file mode 100644 index 000000000..337a3df8b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await adminClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js new file mode 100644 index 000000000..153ee1a90 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the requested instance. Values are of the form + * `projects/{project}/instances/{instance}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js new file mode 100644 index 000000000..34139bc14 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + */ + // const parent = 'abc123' + /** + * Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + */ + // const pageSize = 1234 + /** + * The value of `next_page_token` returned by a previous call. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callListAppProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listAppProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAppProfiles(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js new file mode 100644 index 000000000..2fd8ff90f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance for which a list of clusters is requested. + * Values are of the form `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list Clusters for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + */ + // const parent = 'abc123' + /** + * DEPRECATED: This field is unused and ignored. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callListClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listClusters(request); + console.log(response); + } + + callListClusters(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js new file mode 100644 index 000000000..7f5d170c6 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js @@ -0,0 +1,89 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const parent = 'abc123' + /** + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + */ + // const startTime = {} + /** + * The end time to list hot tablets. + */ + // const endTime = {} + /** + * Maximum number of results per page. + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + */ + // const pageSize = 1234 + /** + * The value of `next_page_token` returned by a previous call. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callListHotTablets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listHotTabletsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHotTablets(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js new file mode 100644 index 000000000..69af4530a --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the project for which a list of instances is requested. + * Values are of the form `projects/{project}`. + */ + // const parent = 'abc123' + /** + * DEPRECATED: This field is unused and ignored. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callListInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listInstances(request); + console.log(response); + } + + callListInstances(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js new file mode 100644 index 000000000..fe17f5f5c --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(cluster, updateMask) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Cluster which contains the partial updates to be applied, subject to + * the update_mask. + */ + // const cluster = {} + /** + * Required. The subset of Cluster fields which should be replaced. + */ + // const updateMask = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callPartialUpdateCluster() { + // Construct request + const request = { + cluster, + updateMask, + }; + + // Run request + const [operation] = await adminClient.partialUpdateCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callPartialUpdateCluster(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js new file mode 100644 index 000000000..bf58de3f3 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, updateMask) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Instance which will (partially) replace the current value. + */ + // const instance = {} + /** + * Required. The subset of Instance fields which should be replaced. + * Must be explicitly set. + */ + // const updateMask = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callPartialUpdateInstance() { + // Construct request + const request = { + instance, + updateMask, + }; + + // Run request + const [operation] = await adminClient.partialUpdateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callPartialUpdateInstance(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js new file mode 100644 index 000000000..9c58200bf --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await adminClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js new file mode 100644 index 000000000..2639051ac --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await adminClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js new file mode 100644 index 000000000..3f597b3da --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(appProfile, updateMask) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The app profile which will (partially) replace the current value. + */ + // const appProfile = {} + /** + * Required. The subset of app profile fields which should be replaced. + * If unset, all fields will be replaced. + */ + // const updateMask = {} + /** + * If true, ignore safety checks when updating the app profile. + */ + // const ignoreWarnings = true + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callUpdateAppProfile() { + // Construct request + const request = { + appProfile, + updateMask, + }; + + // Run request + const [operation] = await adminClient.updateAppProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateAppProfile(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js new file mode 100644 index 000000000..9a8ced3c2 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, state, encryptionConfig) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The unique name of the cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`. + */ + // const name = 'abc123' + /** + * (`CreationOnly`) + * The location where this cluster's nodes and storage reside. For best + * performance, clients should be located as close as possible to this + * cluster. Currently only zones are supported, so values should be of the + * form `projects/{project}/locations/{zone}`. + */ + // const location = 'abc123' + /** + * The current state of the cluster. + */ + // const state = {} + /** + * The number of nodes allocated to this cluster. More nodes enable higher + * throughput and more consistent performance. + */ + // const serveNodes = 1234 + /** + * Configuration for this cluster. + */ + // const clusterConfig = {} + /** + * (`CreationOnly`) + * The type of storage used by this cluster to serve its + * parent instance's tables, unless explicitly overridden. + */ + // const defaultStorageType = {} + /** + * Immutable. The encryption configuration for CMEK-protected clusters. + */ + // const encryptionConfig = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callUpdateCluster() { + // Construct request + const request = { + name, + state, + encryptionConfig, + }; + + // Run request + const [operation] = await adminClient.updateCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateCluster(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js new file mode 100644 index 000000000..83cc071a9 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js @@ -0,0 +1,95 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, displayName, createTime) { + // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The unique name of the instance. Values are of the form + * `projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]`. + */ + // const name = 'abc123' + /** + * Required. The descriptive name for this instance as it appears in UIs. + * Can be changed at any time, but should be kept globally unique + * to avoid confusion. + */ + // const displayName = 'abc123' + /** + * (`OutputOnly`) + * The current state of the instance. + */ + // const state = {} + /** + * The type of the instance. Defaults to `PRODUCTION`. + */ + // const type = {} + /** + * Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. They can be used to filter resources and aggregate + * metrics. + * * Label keys must be between 1 and 63 characters long and must conform to + * the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform to + * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * * Keys and values must both be under 128 bytes. + */ + // const labels = 1234 + /** + * Output only. A server-assigned timestamp representing when this Instance was created. + * For instances created before this field was added (August 2021), this value + * is `seconds: 0, nanos: 1`. + */ + // const createTime = {} + + // Imports the Admin library + const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableInstanceAdminClient(); + + async function callUpdateInstance() { + // Construct request + const request = { + name, + displayName, + createTime, + }; + + // Run request + const response = await adminClient.updateInstance(request); + console.log(response); + } + + callUpdateInstance(); + // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js new file mode 100644 index 000000000..1de65f0dd --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, consistencyToken) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the Table for which to check replication consistency. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + /** + * Required. The token created using GenerateConsistencyToken for the Table. + */ + // const consistencyToken = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callCheckConsistency() { + // Construct request + const request = { + name, + consistencyToken, + }; + + // Run request + const response = await adminClient.checkConsistency(request); + console.log(response); + } + + callCheckConsistency(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js new file mode 100644 index 000000000..eef56574f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backupId, backup) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. This must be one of the clusters in the instance in which this + * table is located. The backup will be stored in this cluster. Values are + * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const parent = 'abc123' + /** + * Required. The id of the backup to be created. The `backup_id` along with + * the parent `parent` are combined as {parent}/backups/{backup_id} to create + * the full backup name, of the form: + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + * This string must be between 1 and 50 characters in length and match the + * regex _a-zA-Z0-9 -_.a-zA-Z0-9 *. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. + */ + // const backup = {} + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await adminClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js new file mode 100644 index 000000000..38c853cc7 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, tableId, table) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + */ + // const parent = 'abc123' + /** + * Required. The name by which the new table should be referred to within the parent + * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * Maximum 50 characters. + */ + // const tableId = 'abc123' + /** + * Required. The Table to create. + */ + // const table = {} + /** + * The optional list of row keys that will be used to initially split the + * table into several tablets (tablets are similar to HBase regions). + * Given two split keys, `s1` and `s2`, three tablets will be created, + * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + * Example: + * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + * `"other", "zz"` + * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + * * Key assignment: + * - Tablet 1 `[, apple) => {"a"}.` + * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + * - Tablet 4 `[customer_2, other) => {"customer_2"}.` + * - Tablet 5 `[other, ) => {"other", "zz"}.` + */ + // const initialSplits = 1234 + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callCreateTable() { + // Construct request + const request = { + parent, + tableId, + table, + }; + + // Run request + const response = await adminClient.createTable(request); + console.log(response); + } + + callCreateTable(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js new file mode 100644 index 000000000..f64723b92 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, tableId, sourceSnapshot) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + */ + // const parent = 'abc123' + /** + * Required. The name by which the new table should be referred to within the parent + * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + */ + // const tableId = 'abc123' + /** + * Required. The unique name of the snapshot from which to restore the table. The + * snapshot and the table must be in the same instance. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + */ + // const sourceSnapshot = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callCreateTableFromSnapshot() { + // Construct request + const request = { + parent, + tableId, + sourceSnapshot, + }; + + // Run request + const [operation] = await adminClient.createTableFromSnapshot(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateTableFromSnapshot(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js new file mode 100644 index 000000000..6ff49c189 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the backup to delete. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteBackup(request); + console.log(response); + } + + callDeleteBackup(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js new file mode 100644 index 000000000..22a602e60 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the snapshot to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callDeleteSnapshot() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteSnapshot(request); + console.log(response); + } + + callDeleteSnapshot(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js new file mode 100644 index 000000000..b5bd9bcc2 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callDeleteTable() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteTable(request); + console.log(response); + } + + callDeleteTable(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js new file mode 100644 index 000000000..2c7593bb1 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table on which to drop a range of rows. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + /** + * Delete all rows that start with this row key prefix. Prefix cannot be + * zero length. + */ + // const rowKeyPrefix = 'Buffer.from('string')' + /** + * Delete all rows in the table. Setting this to false is a no-op. + */ + // const deleteAllDataFromTable = true + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callDropRowRange() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.dropRowRange(request); + console.log(response); + } + + callDropRowRange(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js new file mode 100644 index 000000000..a85007500 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the Table for which to create a consistency token. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callGenerateConsistencyToken() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.generateConsistencyToken(request); + console.log(response); + } + + callGenerateConsistencyToken(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js new file mode 100644 index 000000000..415d8bbfa --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the backup. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js new file mode 100644 index 000000000..568cd6ccc --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = {} + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await adminClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js new file mode 100644 index 000000000..75eed032e --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the requested snapshot. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + */ + // const name = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callGetSnapshot() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getSnapshot(request); + console.log(response); + } + + callGetSnapshot(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js new file mode 100644 index 000000000..8a193836f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the requested table. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + /** + * The view to be applied to the returned table's fields. + * Defaults to `SCHEMA_VIEW` if unspecified. + */ + // const view = {} + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callGetTable() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getTable(request); + console.log(response); + } + + callGetTable(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js new file mode 100644 index 000000000..5645d9771 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js @@ -0,0 +1,126 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + */ + // const parent = 'abc123' + /** + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * Some examples of using filters are: + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + */ + // const filter = 'abc123' + /** + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in Backup google.bigtable.admin.v2.Backup. The full + * syntax is described at https://aip.dev/132#ordering. + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + */ + // const orderBy = 'abc123' + /** + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + */ + // const pageSize = 1234 + /** + * If non-empty, `page_token` should contain a + * next_page_token google.bigtable.admin.v2.ListBackupsResponse.next_page_token from a + * previous ListBackupsResponse google.bigtable.admin.v2.ListBackupsResponse to the same `parent` and with the same + * `filter`. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js new file mode 100644 index 000000000..e7dd971e8 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the cluster for which snapshots should be listed. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + */ + // const parent = 'abc123' + /** + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + */ + // const pageSize = 1234 + /** + * The value of `next_page_token` returned by a previous call. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callListSnapshots() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listSnapshotsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSnapshots(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js new file mode 100644 index 000000000..50cb12c84 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance for which tables should be listed. + * Values are of the form `projects/{project}/instances/{instance}`. + */ + // const parent = 'abc123' + /** + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + */ + // const view = {} + /** + * Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + */ + // const pageSize = 1234 + /** + * The value of `next_page_token` returned by a previous call. + */ + // const pageToken = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callListTables() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listTablesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTables(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js new file mode 100644 index 000000000..55f0b9edb --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, modifications) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table whose families should be modified. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + /** + * Required. Modifications to be atomically applied to the specified table's families. + * Entries are applied in order, meaning that earlier modifications can be + * masked by later ones (in the case of repeated updates to the same family, + * for example). + */ + // const modifications = 1234 + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callModifyColumnFamilies() { + // Construct request + const request = { + name, + modifications, + }; + + // Run request + const response = await adminClient.modifyColumnFamilies(request); + console.log(response); + } + + callModifyColumnFamilies(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js new file mode 100644 index 000000000..c2263f3d3 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, tableId) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the instance in which to create the restored + * table. This instance must be in the same project as the source backup. + * Values are of the form `projects//instances/`. + */ + // const parent = 'abc123' + /** + * Required. The id of the table to create and restore to. This + * table must not already exist. The `table_id` appended to + * `parent` forms the full table name of the form + * `projects//instances//tables/`. + */ + // const tableId = 'abc123' + /** + * Name of the backup from which to restore. Values are of the form + * `projects//instances//clusters//backups/`. + */ + // const backup = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callRestoreTable() { + // Construct request + const request = { + parent, + tableId, + }; + + // Run request + const [operation] = await adminClient.restoreTable(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreTable(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js new file mode 100644 index 000000000..c95cda298 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, policy) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await adminClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js new file mode 100644 index 000000000..39e4efb21 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, cluster, snapshotId) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to have the snapshot taken. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + */ + // const name = 'abc123' + /** + * Required. The name of the cluster where the snapshot will be created in. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + */ + // const cluster = 'abc123' + /** + * Required. The ID by which the new snapshot should be referred to within the parent + * cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` + * rather than + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + */ + // const snapshotId = 'abc123' + /** + * The amount of time that the new snapshot can stay active after it is + * created. Once 'ttl' expires, the snapshot will get deleted. The maximum + * amount of time a snapshot can stay active is 7 days. If 'ttl' is not + * specified, the default value of 24 hours will be used. + */ + // const ttl = {} + /** + * Description of the snapshot. + */ + // const description = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callSnapshotTable() { + // Construct request + const request = { + name, + cluster, + snapshotId, + }; + + // Run request + const [operation] = await adminClient.snapshotTable(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSnapshotTable(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js new file mode 100644 index 000000000..cdfbac097 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await adminClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js new file mode 100644 index 000000000..89a7b332c --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(backup, updateMask) { + // [START bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + */ + // const backup = {} + /** + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + */ + // const updateMask = {} + + // Imports the Admin library + const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const adminClient = new BigtableTableAdminClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + updateMask, + }; + + // Run request + const response = await adminClient.updateBackup(request); + console.log(response); + } + + callUpdateBackup(); + // [END bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json b/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json new file mode 100644 index 000000000..7036bf8d5 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json @@ -0,0 +1,1999 @@ +{ + "clientLibrary": { + "name": "nodejs-admin", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.bigtable.admin.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async", + "title": "bigtable createInstance Sample", + "origin": "API_DEFINITION", + "description": " Create an instance within a project. Note that exactly one of Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is enabled.", + "canonical": true, + "file": "bigtable_instance_admin.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.bigtable.admin.v2.Instance" + }, + { + "name": "clusters", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateInstance", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async", + "title": "bigtable getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets information about an instance.", + "canonical": true, + "file": "bigtable_instance_admin.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.Instance", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async", + "title": "bigtable listInstances Sample", + "origin": "API_DEFINITION", + "description": " Lists information about instances in a project.", + "canonical": true, + "file": "bigtable_instance_admin.list_instances.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListInstances", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListInstancesResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListInstances", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async", + "title": "bigtable updateInstance Sample", + "origin": "API_DEFINITION", + "description": " Updates an instance within a project. This method updates only the display name and type for an Instance. To update other Instance properties, such as labels, use PartialUpdateInstance.", + "canonical": true, + "file": "bigtable_instance_admin.update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "display_name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.bigtable.admin.v2.Instance.State" + }, + { + "name": "type", + "type": ".google.bigtable.admin.v2.Instance.Type" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "create_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.bigtable.admin.v2.Instance", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "UpdateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateInstance", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async", + "title": "bigtable partialUpdateInstance Sample", + "origin": "API_DEFINITION", + "description": " Partially updates an instance within a project. This method can modify all fields of an Instance and is the preferred way to update an Instance.", + "canonical": true, + "file": "bigtable_instance_admin.partial_update_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PartialUpdateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateInstance", + "async": true, + "parameters": [ + { + "name": "instance", + "type": ".google.bigtable.admin.v2.Instance" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "PartialUpdateInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateInstance", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async", + "title": "bigtable deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Delete an instance from a project.", + "canonical": true, + "file": "bigtable_instance_admin.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteInstance", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async", + "title": "bigtable createCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a cluster within an instance. Note that exactly one of Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is enabled.", + "canonical": true, + "file": "bigtable_instance_admin.create_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": ".google.bigtable.admin.v2.Cluster" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "CreateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateCluster", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async", + "title": "bigtable getCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a cluster.", + "canonical": true, + "file": "bigtable_instance_admin.get_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.Cluster", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "GetCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async", + "title": "bigtable listClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists information about clusters in an instance.", + "canonical": true, + "file": "bigtable_instance_admin.list_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListClusters", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListClustersResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListClusters", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async", + "title": "bigtable updateCluster Sample", + "origin": "API_DEFINITION", + "description": " Updates a cluster within an instance. Note that UpdateCluster does not support updating cluster_config.cluster_autoscaling_config. In order to update it, you must use PartialUpdateCluster.", + "canonical": true, + "file": "bigtable_instance_admin.update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.bigtable.admin.v2.Cluster.State" + }, + { + "name": "serve_nodes", + "type": "TYPE_INT32" + }, + { + "name": "cluster_config", + "type": ".google.bigtable.admin.v2.Cluster.ClusterConfig" + }, + { + "name": "default_storage_type", + "type": ".google.bigtable.admin.v2.StorageType" + }, + { + "name": "encryption_config", + "type": ".google.bigtable.admin.v2.Cluster.EncryptionConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "UpdateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateCluster", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async", + "title": "bigtable partialUpdateCluster Sample", + "origin": "API_DEFINITION", + "description": " Partially updates a cluster within a project. This method is the preferred way to update a Cluster. To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the update_mask. To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set a serve_node count via the update_mask.", + "canonical": true, + "file": "bigtable_instance_admin.partial_update_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PartialUpdateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateCluster", + "async": true, + "parameters": [ + { + "name": "cluster", + "type": ".google.bigtable.admin.v2.Cluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "PartialUpdateCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateCluster", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async", + "title": "bigtable deleteCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a cluster from an instance.", + "canonical": true, + "file": "bigtable_instance_admin.delete_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "DeleteCluster", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteCluster", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async", + "title": "bigtable createAppProfile Sample", + "origin": "API_DEFINITION", + "description": " Creates an app profile within an instance.", + "canonical": true, + "file": "bigtable_instance_admin.create_app_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateAppProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "app_profile", + "type": ".google.bigtable.admin.v2.AppProfile" + }, + { + "name": "ignore_warnings", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.bigtable.admin.v2.AppProfile", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "CreateAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateAppProfile", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async", + "title": "bigtable getAppProfile Sample", + "origin": "API_DEFINITION", + "description": " Gets information about an app profile.", + "canonical": true, + "file": "bigtable_instance_admin.get_app_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetAppProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.AppProfile", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "GetAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetAppProfile", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async", + "title": "bigtable listAppProfiles Sample", + "origin": "API_DEFINITION", + "description": " Lists information about app profiles in an instance.", + "canonical": true, + "file": "bigtable_instance_admin.list_app_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAppProfiles", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListAppProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListAppProfilesResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListAppProfiles", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListAppProfiles", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async", + "title": "bigtable updateAppProfile Sample", + "origin": "API_DEFINITION", + "description": " Updates an app profile within an instance.", + "canonical": true, + "file": "bigtable_instance_admin.update_app_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateAppProfile", + "async": true, + "parameters": [ + { + "name": "app_profile", + "type": ".google.bigtable.admin.v2.AppProfile" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "ignore_warnings", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "UpdateAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateAppProfile", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async", + "title": "bigtable deleteAppProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes an app profile from an instance.", + "canonical": true, + "file": "bigtable_instance_admin.delete_app_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteAppProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ignore_warnings", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "DeleteAppProfile", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteAppProfile", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async", + "title": "bigtable getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.", + "canonical": true, + "file": "bigtable_instance_admin.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetIamPolicy", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async", + "title": "bigtable setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on an instance resource. Replaces any existing policy.", + "canonical": true, + "file": "bigtable_instance_admin.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.SetIamPolicy", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async", + "title": "bigtable testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that the caller has on the specified instance resource.", + "canonical": true, + "file": "bigtable_instance_admin.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.TestIamPermissions", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async", + "title": "bigtable listHotTablets Sample", + "origin": "API_DEFINITION", + "description": " Lists hot tablets in a cluster, within the time range provided. Hot tablets are ordered based on CPU usage.", + "canonical": true, + "file": "bigtable_instance_admin.list_hot_tablets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListHotTabletsResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async", + "title": "bigtable createTable Sample", + "origin": "API_DEFINITION", + "description": " Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.", + "canonical": true, + "file": "bigtable_table_admin.create_table.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTable", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "table_id", + "type": "TYPE_STRING" + }, + { + "name": "table", + "type": ".google.bigtable.admin.v2.Table" + }, + { + "name": "initial_splits", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.admin.v2.Table", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "CreateTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTable", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async", + "title": "bigtable createTableFromSnapshot Sample", + "origin": "API_DEFINITION", + "description": " Creates a new table from the specified snapshot. The target table must not exist. The snapshot and the table must be in the same instance. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", + "canonical": true, + "file": "bigtable_table_admin.create_table_from_snapshot.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateTableFromSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "table_id", + "type": "TYPE_STRING" + }, + { + "name": "source_snapshot", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "CreateTableFromSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async", + "title": "bigtable listTables Sample", + "origin": "API_DEFINITION", + "description": " Lists all tables served from a specified instance.", + "canonical": true, + "file": "bigtable_table_admin.list_tables.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTables", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListTables", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.bigtable.admin.v2.Table.View" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListTablesResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "ListTables", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListTables", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async", + "title": "bigtable getTable Sample", + "origin": "API_DEFINITION", + "description": " Gets metadata information about the specified table.", + "canonical": true, + "file": "bigtable_table_admin.get_table.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetTable", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.bigtable.admin.v2.Table.View" + } + ], + "resultType": ".google.bigtable.admin.v2.Table", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "GetTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetTable", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async", + "title": "bigtable deleteTable Sample", + "origin": "API_DEFINITION", + "description": " Permanently deletes a specified table and all of its data.", + "canonical": true, + "file": "bigtable_table_admin.delete_table.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "DeleteTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async", + "title": "bigtable modifyColumnFamilies Sample", + "origin": "API_DEFINITION", + "description": " Performs a series of column family modifications on the specified table. Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.", + "canonical": true, + "file": "bigtable_table_admin.modify_column_families.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ModifyColumnFamilies", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "modifications", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.admin.v2.Table", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "ModifyColumnFamilies", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async", + "title": "bigtable dropRowRange Sample", + "origin": "API_DEFINITION", + "description": " Permanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix.", + "canonical": true, + "file": "bigtable_table_admin.drop_row_range.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DropRowRange", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "row_key_prefix", + "type": "TYPE_BYTES" + }, + { + "name": "delete_all_data_from_table", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "DropRowRange", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async", + "title": "bigtable generateConsistencyToken Sample", + "origin": "API_DEFINITION", + "description": " Generates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.", + "canonical": true, + "file": "bigtable_table_admin.generate_consistency_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateConsistencyToken", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.GenerateConsistencyTokenResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "GenerateConsistencyToken", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async", + "title": "bigtable checkConsistency Sample", + "origin": "API_DEFINITION", + "description": " Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.", + "canonical": true, + "file": "bigtable_table_admin.check_consistency.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CheckConsistency", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "consistency_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.CheckConsistencyResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "CheckConsistency", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async", + "title": "bigtable snapshotTable Sample", + "origin": "API_DEFINITION", + "description": " Creates a new snapshot in the specified cluster from the specified source table. The cluster and the table must be in the same instance. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", + "canonical": true, + "file": "bigtable_table_admin.snapshot_table.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SnapshotTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "cluster", + "type": "TYPE_STRING" + }, + { + "name": "snapshot_id", + "type": "TYPE_STRING" + }, + { + "name": "ttl", + "type": ".google.protobuf.Duration" + }, + { + "name": "description", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "SnapshotTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async", + "title": "bigtable getSnapshot Sample", + "origin": "API_DEFINITION", + "description": " Gets metadata information about the specified snapshot. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", + "canonical": true, + "file": "bigtable_table_admin.get_snapshot.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.Snapshot", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "GetSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async", + "title": "bigtable listSnapshots Sample", + "origin": "API_DEFINITION", + "description": " Lists all snapshots associated with the specified cluster. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", + "canonical": true, + "file": "bigtable_table_admin.list_snapshots.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSnapshots", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListSnapshotsResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "ListSnapshots", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async", + "title": "bigtable deleteSnapshot Sample", + "origin": "API_DEFINITION", + "description": " Permanently deletes the specified snapshot. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", + "canonical": true, + "file": "bigtable_table_admin.delete_snapshot.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "DeleteSnapshot", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async", + "title": "bigtable createBackup Sample", + "origin": "API_DEFINITION", + "description": " Starts creating a new Cloud Bigtable Backup. The returned backup [long-running operation][google.longrunning.Operation] can be used to track creation of the backup. The [metadata][google.longrunning.Operation.metadata] field type is [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the creation and delete the backup.", + "canonical": true, + "file": "bigtable_table_admin.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.bigtable.admin.v2.Backup" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async", + "title": "bigtable getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets metadata on a pending or completed Cloud Bigtable Backup.", + "canonical": true, + "file": "bigtable_table_admin.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.Backup", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetBackup", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async", + "title": "bigtable updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Updates a pending or completed Cloud Bigtable Backup.", + "canonical": true, + "file": "bigtable_table_admin.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.bigtable.admin.v2.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.bigtable.admin.v2.Backup", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async", + "title": "bigtable deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a pending or completed Cloud Bigtable backup.", + "canonical": true, + "file": "bigtable_table_admin.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async", + "title": "bigtable listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists Cloud Bigtable backups. Returns both completed and pending backups.", + "canonical": true, + "file": "bigtable_table_admin.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 118, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListBackupsResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListBackups", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async", + "title": "bigtable restoreTable Sample", + "origin": "API_DEFINITION", + "description": " Create a new table by restoring from a completed backup. The new table must be in the same project as the instance containing the backup. The returned table [long-running operation][google.longrunning.Operation] can be used to track the progress of the operation, and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The [response][google.longrunning.Operation.response] type is [Table][google.bigtable.admin.v2.Table], if successful.", + "canonical": true, + "file": "bigtable_table_admin.restore_table.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "table_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "RestoreTable", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async", + "title": "bigtable getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a Table or Backup resource. Returns an empty policy if the resource exists but does not have a policy set.", + "canonical": true, + "file": "bigtable_table_admin.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetIamPolicy", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async", + "title": "bigtable setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on a Table or Backup resource. Replaces any existing policy.", + "canonical": true, + "file": "bigtable_table_admin.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SetIamPolicy", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async", + "title": "bigtable testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that the caller has on the specified Table or Backup resource.", + "canonical": true, + "file": "bigtable_table_admin.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "BigtableTableAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.TestIamPermissions", + "service": { + "shortName": "BigtableTableAdmin", + "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" + } + } + } + } + ] +} diff --git a/owl-bot-staging/admin/v2/src/index.ts b/owl-bot-staging/admin/v2/src/index.ts new file mode 100644 index 000000000..dcfbea90f --- /dev/null +++ b/owl-bot-staging/admin/v2/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const BigtableInstanceAdminClient = v2.BigtableInstanceAdminClient; +type BigtableInstanceAdminClient = v2.BigtableInstanceAdminClient; +const BigtableTableAdminClient = v2.BigtableTableAdminClient; +type BigtableTableAdminClient = v2.BigtableTableAdminClient; +export {v2, BigtableInstanceAdminClient, BigtableTableAdminClient}; +export default {v2, BigtableInstanceAdminClient, BigtableTableAdminClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts new file mode 100644 index 000000000..66d8812d5 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts @@ -0,0 +1,2869 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/bigtable_instance_admin_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './bigtable_instance_admin_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for creating, configuring, and deleting Cloud Bigtable Instances and + * Clusters. Provides access to the Instance and Cluster schemas only, not the + * tables' metadata or data stored in those tables. + * @class + * @memberof v2 + */ +export class BigtableInstanceAdminClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + bigtableInstanceAdminStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BigtableInstanceAdminClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof BigtableInstanceAdminClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + appProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/appProfiles/{app_profile}' + ), + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}' + ), + clusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}' + ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + snapshotPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}' + ), + tablePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/tables/{table}' + ), + }; + + // 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 = { + listAppProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'appProfiles'), + listHotTablets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hotTablets') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.CreateInstanceMetadata') as gax.protobuf.Type; + const partialUpdateInstanceResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; + const partialUpdateInstanceMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.UpdateInstanceMetadata') as gax.protobuf.Type; + const createClusterResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; + const createClusterMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.CreateClusterMetadata') as gax.protobuf.Type; + const updateClusterResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; + const updateClusterMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.UpdateClusterMetadata') as gax.protobuf.Type; + const partialUpdateClusterResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; + const partialUpdateClusterMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.PartialUpdateClusterMetadata') as gax.protobuf.Type; + const updateAppProfileResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.AppProfile') as gax.protobuf.Type; + const updateAppProfileMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.UpdateAppProfileMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + partialUpdateInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + partialUpdateInstanceResponse.decode.bind(partialUpdateInstanceResponse), + partialUpdateInstanceMetadata.decode.bind(partialUpdateInstanceMetadata)), + 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)), + partialUpdateCluster: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + partialUpdateClusterResponse.decode.bind(partialUpdateClusterResponse), + partialUpdateClusterMetadata.decode.bind(partialUpdateClusterMetadata)), + updateAppProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateAppProfileResponse.decode.bind(updateAppProfileResponse), + updateAppProfileMetadata.decode.bind(updateAppProfileMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.bigtable.admin.v2.BigtableInstanceAdmin', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.bigtableInstanceAdminStub) { + return this.bigtableInstanceAdminStub; + } + + // Put together the "service stub" for + // google.bigtable.admin.v2.BigtableInstanceAdmin. + this.bigtableInstanceAdminStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableInstanceAdmin') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.bigtable.admin.v2.BigtableInstanceAdmin, + 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 bigtableInstanceAdminStubMethods = + ['createInstance', 'getInstance', 'listInstances', 'updateInstance', 'partialUpdateInstance', 'deleteInstance', 'createCluster', 'getCluster', 'listClusters', 'updateCluster', 'partialUpdateCluster', 'deleteCluster', 'createAppProfile', 'getAppProfile', 'listAppProfiles', 'updateAppProfile', 'deleteAppProfile', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', 'listHotTablets']; + for (const methodName of bigtableInstanceAdminStubMethods) { + const callPromise = this.bigtableInstanceAdminStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.bigtableInstanceAdminStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'bigtableadmin.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 'bigtableadmin.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/bigtable.admin', + 'https://www.googleapis.com/auth/bigtable.admin.cluster', + 'https://www.googleapis.com/auth/bigtable.admin.instance', + 'https://www.googleapis.com/auth/cloud-bigtable.admin', + 'https://www.googleapis.com/auth/cloud-bigtable.admin.cluster', + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only' + ]; + } + + 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 information about an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested instance. Values are of the form + * `projects/{project}/instances/{instance}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.bigtable.admin.v2.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async + */ + getInstance( + request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.bigtable.admin.v2.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.bigtable.admin.v2.IGetInstanceRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getInstance(request, options, callback); + } +/** + * Lists information about instances in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the project for which a list of instances is requested. + * Values are of the form `projects/{project}`. + * @param {string} request.pageToken + * DEPRECATED: This field is unused and ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListInstancesResponse]{@link google.bigtable.admin.v2.ListInstancesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_instances.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async + */ + listInstances( + request?: protos.google.bigtable.admin.v2.IListInstancesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined + ]>; + listInstances( + request: protos.google.bigtable.admin.v2.IListInstancesRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): void; + listInstances( + request: protos.google.bigtable.admin.v2.IListInstancesRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): void; + listInstances( + request?: protos.google.bigtable.admin.v2.IListInstancesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IListInstancesResponse, + protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listInstances(request, options, callback); + } +/** + * Updates an instance within a project. This method updates only the display + * name and type for an Instance. To update other Instance properties, such as + * labels, use PartialUpdateInstance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The unique name of the instance. Values are of the form + * `projects/{project}/instances/{@link a-z0-9\\-|a-z}+[a-z0-9]`. + * @param {string} request.displayName + * Required. The descriptive name for this instance as it appears in UIs. + * Can be changed at any time, but should be kept globally unique + * to avoid confusion. + * @param {google.bigtable.admin.v2.Instance.State} request.state + * (`OutputOnly`) + * The current state of the instance. + * @param {google.bigtable.admin.v2.Instance.Type} request.type + * The type of the instance. Defaults to `PRODUCTION`. + * @param {number[]} request.labels + * Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. They can be used to filter resources and aggregate + * metrics. + * + * * Label keys must be between 1 and 63 characters long and must conform to + * the regular expression: `{@link \p{Ll}\p{Lo}\p{N}_-|\p{Ll}\p{Lo}}{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform to + * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * * Keys and values must both be under 128 bytes. + * @param {google.protobuf.Timestamp} request.createTime + * Output only. A server-assigned timestamp representing when this Instance was created. + * For instances created before this field was added (August 2021), this value + * is `seconds: 0, nanos: 1`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.bigtable.admin.v2.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async + */ + updateInstance( + request?: protos.google.bigtable.admin.v2.IInstance, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined + ]>; + updateInstance( + request: protos.google.bigtable.admin.v2.IInstance, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): void; + updateInstance( + request: protos.google.bigtable.admin.v2.IInstance, + callback: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): void; + updateInstance( + request?: protos.google.bigtable.admin.v2.IInstance, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IInstance, + protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateInstance(request, options, callback); + } +/** + * Delete an instance from a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the instance to be deleted. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteInstance(request, options, callback); + } +/** + * Gets information about a cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Cluster]{@link google.bigtable.admin.v2.Cluster}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async + */ + getCluster( + request?: protos.google.bigtable.admin.v2.IGetClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|undefined, {}|undefined + ]>; + getCluster( + request: protos.google.bigtable.admin.v2.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request: protos.google.bigtable.admin.v2.IGetClusterRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): void; + getCluster( + request?: protos.google.bigtable.admin.v2.IGetClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ICluster, + protos.google.bigtable.admin.v2.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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCluster(request, options, callback); + } +/** + * Lists information about clusters in an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of clusters is requested. + * Values are of the form `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list Clusters for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {string} request.pageToken + * DEPRECATED: This field is unused and ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListClustersResponse]{@link google.bigtable.admin.v2.ListClustersResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_clusters.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async + */ + listClusters( + request?: protos.google.bigtable.admin.v2.IListClustersRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined + ]>; + listClusters( + request: protos.google.bigtable.admin.v2.IListClustersRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request: protos.google.bigtable.admin.v2.IListClustersRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): void; + listClusters( + request?: protos.google.bigtable.admin.v2.IListClustersRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IListClustersResponse, + protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listClusters(request, options, callback); + } +/** + * Deletes a cluster from an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the cluster to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async + */ + deleteCluster( + request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined + ]>; + deleteCluster( + request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): void; + deleteCluster( + request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCluster(request, options, callback); + } +/** + * Creates an app profile within an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the new app profile. + * Values are of the form + * `projects/{project}/instances/{instance}`. + * @param {string} request.appProfileId + * Required. The ID to be used when referring to the new app profile within its + * instance, e.g., just `myprofile` rather than + * `projects/myproject/instances/myinstance/appProfiles/myprofile`. + * @param {google.bigtable.admin.v2.AppProfile} request.appProfile + * Required. The app profile to be created. + * Fields marked `OutputOnly` will be ignored. + * @param {boolean} request.ignoreWarnings + * If true, ignore safety checks when creating the app profile. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async + */ + createAppProfile( + request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined + ]>; + createAppProfile( + request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): void; + createAppProfile( + request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): void; + createAppProfile( + request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createAppProfile(request, options, callback); + } +/** + * Gets information about an app profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested app profile. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async + */ + getAppProfile( + request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined + ]>; + getAppProfile( + request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): void; + getAppProfile( + request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): void; + getAppProfile( + request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile, + protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAppProfile(request, options, callback); + } +/** + * Deletes an app profile from an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the app profile to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. + * @param {boolean} request.ignoreWarnings + * Required. If true, ignore safety checks when deleting the app profile. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.delete_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async + */ + deleteAppProfile( + request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined + ]>; + deleteAppProfile( + request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): void; + deleteAppProfile( + request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): void; + deleteAppProfile( + request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAppProfile(request, options, callback); + } +/** + * Gets the access control policy for an instance resource. Returns an empty + * policy if an instance exists but 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 {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.get_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Sets the access control policy on an instance resource. Replaces any + * existing policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.set_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns permissions that the caller has on the specified instance resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + +/** + * Create an instance within a project. + * + * Note that exactly one of Cluster.serve_nodes and + * Cluster.cluster_config.cluster_autoscaling_config can be set. If + * serve_nodes is set to non-zero, then the cluster is manually scaled. If + * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + * enabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the project in which to create the new instance. + * Values are of the form `projects/{project}`. + * @param {string} request.instanceId + * Required. The ID to be used when referring to the new instance within its project, + * e.g., just `myinstance` rather than + * `projects/myproject/instances/myinstance`. + * @param {google.bigtable.admin.v2.Instance} request.instance + * Required. The instance to create. + * Fields marked `OutputOnly` must be left blank. + * @param {number[]} request.clusters + * Required. The clusters to be created within the instance, mapped by desired + * cluster ID, e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + * Fields marked `OutputOnly` must be left blank. + * Currently, at most four clusters can be specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async + */ + createInstance( + request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Partially updates an instance within a project. This method can modify all + * fields of an Instance and is the preferred way to update an Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Instance} request.instance + * Required. The Instance which will (partially) replace the current value. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of Instance fields which should be replaced. + * Must be explicitly set. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async + */ + partialUpdateInstance( + request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + partialUpdateInstance( + request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + partialUpdateInstance( + request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + partialUpdateInstance( + request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'instance.name': request.instance!.name || '', + }); + this.initialize(); + return this.innerApiCalls.partialUpdateInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `partialUpdateInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_instance.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async + */ + async checkPartialUpdateInstanceProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateInstance, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a cluster within an instance. + * + * Note that exactly one of Cluster.serve_nodes and + * Cluster.cluster_config.cluster_autoscaling_config can be set. If + * serve_nodes is set to non-zero, then the cluster is manually scaled. If + * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is + * enabled. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the new cluster. + * Values are of the form + * `projects/{project}/instances/{instance}`. + * @param {string} request.clusterId + * Required. The ID to be used when referring to the new cluster within its instance, + * e.g., just `mycluster` rather than + * `projects/myproject/instances/myinstance/clusters/mycluster`. + * @param {google.bigtable.admin.v2.Cluster} request.cluster + * Required. The cluster to be created. + * Fields marked `OutputOnly` must be left blank. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async + */ + createCluster( + request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createCluster( + request: protos.google.bigtable.admin.v2.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request: protos.google.bigtable.admin.v2.ICreateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createCluster( + request?: protos.google.bigtable.admin.v2.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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.create_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async + */ + async checkCreateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a cluster within an instance. + * + * Note that UpdateCluster does not support updating + * cluster_config.cluster_autoscaling_config. In order to update it, you + * must use PartialUpdateCluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The unique name of the cluster. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{@link -a-z0-9|a-z}*`. + * @param {string} request.location + * (`CreationOnly`) + * The location where this cluster's nodes and storage reside. For best + * performance, clients should be located as close as possible to this + * cluster. Currently only zones are supported, so values should be of the + * form `projects/{project}/locations/{zone}`. + * @param {google.bigtable.admin.v2.Cluster.State} request.state + * The current state of the cluster. + * @param {number} request.serveNodes + * The number of nodes allocated to this cluster. More nodes enable higher + * throughput and more consistent performance. + * @param {google.bigtable.admin.v2.Cluster.ClusterConfig} request.clusterConfig + * Configuration for this cluster. + * @param {google.bigtable.admin.v2.StorageType} request.defaultStorageType + * (`CreationOnly`) + * The type of storage used by this cluster to serve its + * parent instance's tables, unless explicitly overridden. + * @param {google.bigtable.admin.v2.Cluster.EncryptionConfig} request.encryptionConfig + * Immutable. The encryption configuration for CMEK-protected clusters. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async + */ + updateCluster( + request?: protos.google.bigtable.admin.v2.ICluster, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateCluster( + request: protos.google.bigtable.admin.v2.ICluster, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request: protos.google.bigtable.admin.v2.ICluster, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateCluster( + request?: protos.google.bigtable.admin.v2.ICluster, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async + */ + async checkUpdateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Partially updates a cluster within a project. This method is the preferred + * way to update a Cluster. + * + * To enable and update autoscaling, set + * cluster_config.cluster_autoscaling_config. When autoscaling is enabled, + * serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it + * are ignored. Note that an update cannot simultaneously set serve_nodes to + * non-zero and cluster_config.cluster_autoscaling_config to non-empty, and + * also specify both in the update_mask. + * + * To disable autoscaling, clear cluster_config.cluster_autoscaling_config, + * and explicitly set a serve_node count via the update_mask. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Cluster} request.cluster + * Required. The Cluster which contains the partial updates to be applied, subject to + * the update_mask. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of Cluster fields which should be replaced. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async + */ + partialUpdateCluster( + request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + partialUpdateCluster( + request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + partialUpdateCluster( + request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + partialUpdateCluster( + request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'cluster.name': request.cluster!.name || '', + }); + this.initialize(); + return this.innerApiCalls.partialUpdateCluster(request, options, callback); + } +/** + * Check the status of the long running operation returned by `partialUpdateCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async + */ + async checkPartialUpdateClusterProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateCluster, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates an app profile within an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.AppProfile} request.appProfile + * Required. The app profile which will (partially) replace the current value. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The subset of app profile fields which should be replaced. + * If unset, all fields will be replaced. + * @param {boolean} request.ignoreWarnings + * If true, ignore safety checks when updating the app profile. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async + */ + updateAppProfile( + request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateAppProfile( + request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAppProfile( + request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateAppProfile( + request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'app_profile.name': request.appProfile!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAppProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateAppProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.update_app_profile.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async + */ + async checkUpdateAppProfileProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateAppProfile, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists information about app profiles in an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. + * 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 `listAppProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAppProfiles( + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile[], + protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, + protos.google.bigtable.admin.v2.IListAppProfilesResponse + ]>; + listAppProfiles( + request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): void; + listAppProfiles( + request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): void; + listAppProfiles( + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListAppProfilesRequest, + protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, + protos.google.bigtable.admin.v2.IAppProfile>): + Promise<[ + protos.google.bigtable.admin.v2.IAppProfile[], + protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, + protos.google.bigtable.admin.v2.IListAppProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAppProfiles(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 unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile} 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 `listAppProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAppProfilesStream( + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAppProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAppProfiles.createStream( + this.innerApiCalls.listAppProfiles as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAppProfiles`, 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 unique name of the instance for which a list of app profiles is + * requested. Values are of the form + * `projects/{project}/instances/{instance}`. + * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, + * e.g., `projects/myproject/instances/-`. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_app_profiles.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async + */ + listAppProfilesAsync( + request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAppProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAppProfiles.asyncIterate( + this.innerApiCalls['listAppProfiles'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists hot tablets in a cluster, within the time range provided. Hot + * tablets are ordered based on CPU usage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. + * 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 `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ]>; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): void; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): void; + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, + protos.google.bigtable.admin.v2.IHotTablet>): + Promise<[ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHotTablets(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 cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet} 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 `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTabletsStream( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.createStream( + this.innerApiCalls.listHotTablets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHotTablets`, 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 cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async + */ + listHotTabletsAsync( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.asyncIterate( + this.innerApiCalls['listHotTablets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified appProfile resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} app_profile + * @returns {string} Resource name string. + */ + appProfilePath(project:string,instance:string,appProfile:string) { + return this.pathTemplates.appProfilePathTemplate.render({ + project: project, + instance: instance, + app_profile: appProfile, + }); + } + + /** + * Parse the project from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; + } + + /** + * Parse the instance from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; + } + + /** + * Parse the app_profile from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the app_profile. + */ + matchAppProfileFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; + } + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,instance:string,cluster:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the instance from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).instance; + } + + /** + * Parse the cluster from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).cluster; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified cluster resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @returns {string} Resource name string. + */ + clusterPath(project:string,instance:string,cluster:string) { + return this.pathTemplates.clusterPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + }); + } + + /** + * Parse the project from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).project; + } + + /** + * Parse the instance from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).instance; + } + + /** + * Parse the cluster from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; + } + + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * 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 snapshot resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} snapshot + * @returns {string} Resource name string. + */ + snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { + return this.pathTemplates.snapshotPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + snapshot: snapshot, + }); + } + + /** + * Parse the project from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; + } + + /** + * Parse the instance from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; + } + + /** + * Parse the cluster from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).cluster; + } + + /** + * Parse the snapshot from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the snapshot. + */ + matchSnapshotFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; + } + + /** + * Return a fully-qualified table resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} table + * @returns {string} Resource name string. + */ + tablePath(project:string,instance:string,table:string) { + return this.pathTemplates.tablePathTemplate.render({ + project: project, + instance: instance, + table: table, + }); + } + + /** + * Parse the project from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).project; + } + + /** + * Parse the instance from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).instance; + } + + /** + * Parse the table from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the table. + */ + matchTableFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).table; + } + + /** + * 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.bigtableInstanceAdminStub && !this._terminated) { + return this.bigtableInstanceAdminStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json new file mode 100644 index 000000000..bb5e050c1 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json @@ -0,0 +1,140 @@ +{ + "interfaces": { + "google.bigtable.admin.v2.BigtableInstanceAdmin": { + "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 + }, + "264268458a9e88347dbacbd9398202ff5885a40b": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateInstance": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "PartialUpdateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteInstance": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetCluster": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListClusters": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "PartialUpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAppProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAppProfile": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListAppProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateAppProfile": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteAppProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListHotTablets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + } + } + } + } +} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json new file mode 100644 index 000000000..1f7e1af50 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json @@ -0,0 +1,7 @@ +[ + "../../protos/google/bigtable/admin/v2/bigtable_instance_admin.proto", + "../../protos/google/bigtable/admin/v2/bigtable_table_admin.proto", + "../../protos/google/bigtable/admin/v2/common.proto", + "../../protos/google/bigtable/admin/v2/instance.proto", + "../../protos/google/bigtable/admin/v2/table.proto" +] diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts new file mode 100644 index 000000000..77b48f59d --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts @@ -0,0 +1,3142 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/bigtable_table_admin_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './bigtable_table_admin_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for creating, configuring, and deleting Cloud Bigtable tables. + * + * + * Provides access to the table schemas only, not the data stored within + * the tables. + * @class + * @memberof v2 + */ +export class BigtableTableAdminClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + bigtableTableAdminStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BigtableTableAdminClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof BigtableTableAdminClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + appProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/appProfiles/{app_profile}' + ), + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}' + ), + clusterPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}' + ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}' + ), + snapshotPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}' + ), + tablePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/tables/{table}' + ), + }; + + // 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 = { + listTables: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tables'), + listSnapshots: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'snapshots'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createTableFromSnapshotResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; + const createTableFromSnapshotMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata') as gax.protobuf.Type; + const snapshotTableResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Snapshot') as gax.protobuf.Type; + const snapshotTableMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.SnapshotTableMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.CreateBackupMetadata') as gax.protobuf.Type; + const restoreTableResponse = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; + const restoreTableMetadata = protoFilesRoot.lookup( + '.google.bigtable.admin.v2.RestoreTableMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createTableFromSnapshot: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createTableFromSnapshotResponse.decode.bind(createTableFromSnapshotResponse), + createTableFromSnapshotMetadata.decode.bind(createTableFromSnapshotMetadata)), + snapshotTable: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + snapshotTableResponse.decode.bind(snapshotTableResponse), + snapshotTableMetadata.decode.bind(snapshotTableMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + restoreTable: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreTableResponse.decode.bind(restoreTableResponse), + restoreTableMetadata.decode.bind(restoreTableMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.bigtable.admin.v2.BigtableTableAdmin', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.bigtableTableAdminStub) { + return this.bigtableTableAdminStub; + } + + // Put together the "service stub" for + // google.bigtable.admin.v2.BigtableTableAdmin. + this.bigtableTableAdminStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableTableAdmin') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.bigtable.admin.v2.BigtableTableAdmin, + 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 bigtableTableAdminStubMethods = + ['createTable', 'createTableFromSnapshot', 'listTables', 'getTable', 'deleteTable', 'modifyColumnFamilies', 'dropRowRange', 'generateConsistencyToken', 'checkConsistency', 'snapshotTable', 'getSnapshot', 'listSnapshots', 'deleteSnapshot', 'createBackup', 'getBackup', 'updateBackup', 'deleteBackup', 'listBackups', 'restoreTable', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; + for (const methodName of bigtableTableAdminStubMethods) { + const callPromise = this.bigtableTableAdminStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.bigtableTableAdminStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'bigtableadmin.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 'bigtableadmin.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/bigtable.admin', + 'https://www.googleapis.com/auth/bigtable.admin.table', + 'https://www.googleapis.com/auth/cloud-bigtable.admin', + 'https://www.googleapis.com/auth/cloud-bigtable.admin.table', + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only' + ]; + } + + 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 a new table in the specified instance. + * The table can be created with a full set of initial column families, + * specified in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {string} request.tableId + * Required. The name by which the new table should be referred to within the parent + * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * Maximum 50 characters. + * @param {google.bigtable.admin.v2.Table} request.table + * Required. The Table to create. + * @param {number[]} request.initialSplits + * The optional list of row keys that will be used to initially split the + * table into several tablets (tablets are similar to HBase regions). + * Given two split keys, `s1` and `s2`, three tablets will be created, + * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + * + * Example: + * + * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + * `"other", "zz"]` + * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + * * Key assignment: + * - Tablet 1 `[, apple) => {"a"}.` + * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + * - Tablet 4 `[customer_2, other) => {"customer_2"}.` + * - Tablet 5 `[other, ) => {"other", "zz"}.` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async + */ + createTable( + request?: protos.google.bigtable.admin.v2.ICreateTableRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined + ]>; + createTable( + request: protos.google.bigtable.admin.v2.ICreateTableRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): void; + createTable( + request: protos.google.bigtable.admin.v2.ICreateTableRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): void; + createTable( + request?: protos.google.bigtable.admin.v2.ICreateTableRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createTable(request, options, callback); + } +/** + * Gets metadata information about the specified table. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested table. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned table's fields. + * Defaults to `SCHEMA_VIEW` if unspecified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async + */ + getTable( + request?: protos.google.bigtable.admin.v2.IGetTableRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined + ]>; + getTable( + request: protos.google.bigtable.admin.v2.IGetTableRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): void; + getTable( + request: protos.google.bigtable.admin.v2.IGetTableRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): void; + getTable( + request?: protos.google.bigtable.admin.v2.IGetTableRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getTable(request, options, callback); + } +/** + * Permanently deletes a specified table and all of its data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async + */ + deleteTable( + request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined + ]>; + deleteTable( + request: protos.google.bigtable.admin.v2.IDeleteTableRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): void; + deleteTable( + request: protos.google.bigtable.admin.v2.IDeleteTableRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): void; + deleteTable( + request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTable(request, options, callback); + } +/** + * Performs a series of column family modifications on the specified table. + * Either all or none of the modifications will occur before this method + * returns, but data requests received prior to that point may see a table + * where only some modifications have taken effect. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table whose families should be modified. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {number[]} request.modifications + * Required. Modifications to be atomically applied to the specified table's families. + * Entries are applied in order, meaning that earlier modifications can be + * masked by later ones (in the case of repeated updates to the same family, + * for example). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.modify_column_families.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async + */ + modifyColumnFamilies( + request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined + ]>; + modifyColumnFamilies( + request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): void; + modifyColumnFamilies( + request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): void; + modifyColumnFamilies( + request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ITable, + protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.modifyColumnFamilies(request, options, callback); + } +/** + * Permanently drop/delete a row range from a specified table. The request can + * specify whether to delete all rows in a table, or only those that match a + * particular prefix. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table on which to drop a range of rows. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {Buffer} request.rowKeyPrefix + * Delete all rows that start with this row key prefix. Prefix cannot be + * zero length. + * @param {boolean} request.deleteAllDataFromTable + * Delete all rows in the table. Setting this to false is a no-op. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.drop_row_range.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async + */ + dropRowRange( + request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined + ]>; + dropRowRange( + request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): void; + dropRowRange( + request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): void; + dropRowRange( + request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.dropRowRange(request, options, callback); + } +/** + * Generates a consistency token for a Table, which can be used in + * CheckConsistency to check whether mutations to the table that finished + * before this call started have been replicated. The tokens will be available + * for 90 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the Table for which to create a consistency token. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateConsistencyTokenResponse]{@link google.bigtable.admin.v2.GenerateConsistencyTokenResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.generate_consistency_token.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async + */ + generateConsistencyToken( + request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined + ]>; + generateConsistencyToken( + request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): void; + generateConsistencyToken( + request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): void; + generateConsistencyToken( + request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, + protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateConsistencyToken(request, options, callback); + } +/** + * Checks replication consistency based on a consistency token, that is, if + * replication has caught up based on the conditions specified in the token + * and the check request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the Table for which to check replication consistency. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {string} request.consistencyToken + * Required. The token created using GenerateConsistencyToken for the Table. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CheckConsistencyResponse]{@link google.bigtable.admin.v2.CheckConsistencyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.check_consistency.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async + */ + checkConsistency( + request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined + ]>; + checkConsistency( + request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): void; + checkConsistency( + request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): void; + checkConsistency( + request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ICheckConsistencyResponse, + protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.checkConsistency(request, options, callback); + } +/** + * Gets metadata information about the specified snapshot. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the requested snapshot. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async + */ + getSnapshot( + request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined + ]>; + getSnapshot( + request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; + getSnapshot( + request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + callback: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): void; + getSnapshot( + request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot, + protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSnapshot(request, options, callback); + } +/** + * Permanently deletes the specified snapshot. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the snapshot to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async + */ + deleteSnapshot( + request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined + ]>; + deleteSnapshot( + request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; + deleteSnapshot( + request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): void; + deleteSnapshot( + request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSnapshot(request, options, callback); + } +/** + * Gets metadata on a pending or completed Cloud Bigtable Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.bigtable.admin.v2.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async + */ + getBackup( + request?: protos.google.bigtable.admin.v2.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.bigtable.admin.v2.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.bigtable.admin.v2.IGetBackupRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.bigtable.admin.v2.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getBackup(request, options, callback); + } +/** + * Updates a pending or completed Cloud Bigtable Backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.bigtable.admin.v2.Backup} request.backup + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.bigtable.admin.v2.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.update_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async + */ + updateBackup( + request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined + ]>; + updateBackup( + request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): void; + updateBackup( + request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + callback: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): void; + updateBackup( + request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup, + protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'backup.name': request.backup!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateBackup(request, options, callback); + } +/** + * Deletes a pending or completed Cloud Bigtable backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the backup to delete. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.delete_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Gets the access control policy for a Table or Backup resource. + * Returns an empty policy if the resource exists but 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 {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.get_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Sets the access control policy on a Table or Backup resource. + * Replaces any existing policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.set_iam_policy.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns permissions that the caller has on the specified Table or Backup resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.test_iam_permissions.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + +/** + * Creates a new table from the specified snapshot. The target table must + * not exist. The snapshot and the table must be in the same instance. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance in which to create the table. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {string} request.tableId + * Required. The name by which the new table should be referred to within the parent + * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * @param {string} request.sourceSnapshot + * Required. The unique name of the snapshot from which to restore the table. The + * snapshot and the table must be in the same instance. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async + */ + createTableFromSnapshot( + request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createTableFromSnapshot( + request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createTableFromSnapshot( + request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createTableFromSnapshot( + request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createTableFromSnapshot(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createTableFromSnapshot()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async + */ + async checkCreateTableFromSnapshotProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createTableFromSnapshot, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new snapshot in the specified cluster from the specified + * source table. The cluster and the table must be in the same instance. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the table to have the snapshot taken. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param {string} request.cluster + * Required. The name of the cluster where the snapshot will be created in. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {string} request.snapshotId + * Required. The ID by which the new snapshot should be referred to within the parent + * cluster, e.g., `mysnapshot` of the form: `{@link -_.a-zA-Z0-9|_a-zA-Z0-9}*` + * rather than + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param {google.protobuf.Duration} request.ttl + * The amount of time that the new snapshot can stay active after it is + * created. Once 'ttl' expires, the snapshot will get deleted. The maximum + * amount of time a snapshot can stay active is 7 days. If 'ttl' is not + * specified, the default value of 24 hours will be used. + * @param {string} request.description + * Description of the snapshot. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async + */ + snapshotTable( + request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + snapshotTable( + request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + snapshotTable( + request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + snapshotTable( + request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.snapshotTable(request, options, callback); + } +/** + * Check the status of the long running operation returned by `snapshotTable()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.snapshot_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async + */ + async checkSnapshotTableProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.snapshotTable, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts creating a new Cloud Bigtable Backup. The returned backup + * {@link google.longrunning.Operation|long-running operation} can be used to + * track creation of the backup. The + * {@link google.longrunning.Operation.metadata|metadata} field type is + * {@link google.bigtable.admin.v2.CreateBackupMetadata|CreateBackupMetadata}. The + * {@link google.longrunning.Operation.response|response} field type is + * {@link google.bigtable.admin.v2.Backup|Backup}, if successful. Cancelling the returned operation will stop the + * creation and delete the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. This must be one of the clusters in the instance in which this + * table is located. The backup will be stored in this cluster. Values are + * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {string} request.backupId + * Required. The id of the backup to be created. The `backup_id` along with + * the parent `parent` are combined as {parent}/backups/{backup_id} to create + * the full backup name, of the form: + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. + * This string must be between 1 and 50 characters in length and match the + * regex {@link -_.a-zA-Z0-9|_a-zA-Z0-9}*. + * @param {google.bigtable.admin.v2.Backup} request.backup + * Required. The backup to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async + */ + createBackup( + request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.bigtable.admin.v2.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.bigtable.admin.v2.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.create_backup.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new table by restoring from a completed backup. The new table + * must be in the same project as the instance containing the backup. The + * returned table {@link google.longrunning.Operation|long-running operation} can + * be used to track the progress of the operation, and to cancel it. The + * {@link google.longrunning.Operation.metadata|metadata} field type is + * {@link google.bigtable.admin.RestoreTableMetadata|RestoreTableMetadata}. The + * {@link google.longrunning.Operation.response|response} type is + * {@link google.bigtable.admin.v2.Table|Table}, if successful. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the instance in which to create the restored + * table. This instance must be in the same project as the source backup. + * Values are of the form `projects//instances/`. + * @param {string} request.tableId + * Required. The id of the table to create and restore to. This + * table must not already exist. The `table_id` appended to + * `parent` forms the full table name of the form + * `projects//instances//tables/`. + * @param {string} request.backup + * Name of the backup from which to restore. Values are of the form + * `projects//instances//clusters//backups/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async + */ + restoreTable( + request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreTable( + request: protos.google.bigtable.admin.v2.IRestoreTableRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreTable( + request: protos.google.bigtable.admin.v2.IRestoreTableRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreTable( + request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.restoreTable(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreTable()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.restore_table.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async + */ + async checkRestoreTableProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreTable, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists all tables served from a specified instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the instance for which tables should be listed. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Table]{@link google.bigtable.admin.v2.Table}. + * 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 `listTablesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTables( + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ITable[], + protos.google.bigtable.admin.v2.IListTablesRequest|null, + protos.google.bigtable.admin.v2.IListTablesResponse + ]>; + listTables( + request: protos.google.bigtable.admin.v2.IListTablesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): void; + listTables( + request: protos.google.bigtable.admin.v2.IListTablesRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): void; + listTables( + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListTablesRequest, + protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, + protos.google.bigtable.admin.v2.ITable>): + Promise<[ + protos.google.bigtable.admin.v2.ITable[], + protos.google.bigtable.admin.v2.IListTablesRequest|null, + protos.google.bigtable.admin.v2.IListTablesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listTables(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 unique name of the instance for which tables should be listed. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 [Table]{@link google.bigtable.admin.v2.Table} 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 `listTablesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTablesStream( + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listTables']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTables.createStream( + this.innerApiCalls.listTables as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTables`, 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 unique name of the instance for which tables should be listed. + * Values are of the form `projects/{project}/instances/{instance}`. + * @param {google.bigtable.admin.v2.Table.View} request.view + * The view to be applied to the returned tables' fields. + * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Table]{@link google.bigtable.admin.v2.Table}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_tables.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async + */ + listTablesAsync( + request?: protos.google.bigtable.admin.v2.IListTablesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listTables']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTables.asyncIterate( + this.innerApiCalls['listTables'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all snapshots associated with the specified cluster. + * + * Note: This is a private alpha release of Cloud Bigtable snapshots. This + * feature is not currently available to most Cloud Bigtable customers. This + * feature might be changed in backward-incompatible ways and is not + * recommended for production use. It is not subject to any SLA or deprecation + * policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique name of the cluster for which snapshots should be listed. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. + * 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 `listSnapshotsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSnapshots( + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot[], + protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, + protos.google.bigtable.admin.v2.IListSnapshotsResponse + ]>; + listSnapshots( + request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): void; + listSnapshots( + request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): void; + listSnapshots( + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListSnapshotsRequest, + protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, + protos.google.bigtable.admin.v2.ISnapshot>): + Promise<[ + protos.google.bigtable.admin.v2.ISnapshot[], + protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, + protos.google.bigtable.admin.v2.IListSnapshotsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSnapshots(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 unique name of the cluster for which snapshots should be listed. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot} 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 `listSnapshotsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSnapshotsStream( + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSnapshots']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSnapshots.createStream( + this.innerApiCalls.listSnapshots as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSnapshots`, 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 unique name of the cluster for which snapshots should be listed. + * Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {number} request.pageSize + * The maximum number of snapshots to return per page. + * CURRENTLY UNIMPLEMENTED AND IGNORED. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_snapshots.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async + */ + listSnapshotsAsync( + request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSnapshots']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSnapshots.asyncIterate( + this.innerApiCalls['listSnapshots'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists Cloud Bigtable backups. Returns both completed and pending + * backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full + * syntax is described at https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @param {number} request.pageSize + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a + * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same + * `filter`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Backup]{@link google.bigtable.admin.v2.Backup}. + * 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.admin.v2.IBackup[], + protos.google.bigtable.admin.v2.IListBackupsRequest|null, + protos.google.bigtable.admin.v2.IListBackupsResponse + ]>; + listBackups( + request: protos.google.bigtable.admin.v2.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): void; + listBackups( + request: protos.google.bigtable.admin.v2.IListBackupsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): void; + listBackups( + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListBackupsRequest, + protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, + protos.google.bigtable.admin.v2.IBackup>): + Promise<[ + protos.google.bigtable.admin.v2.IBackup[], + protos.google.bigtable.admin.v2.IListBackupsRequest|null, + protos.google.bigtable.admin.v2.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listBackups(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 cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full + * syntax is described at https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @param {number} request.pageSize + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a + * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same + * `filter`. + * @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 [Backup]{@link google.bigtable.admin.v2.Backup} 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 `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, 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 cluster to list backups from. Values are of the + * form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * Use `{cluster} = '-'` to list backups for all clusters in an instance, + * e.g., `projects/{project}/instances/{instance}/clusters/-`. + * @param {string} request.filter + * A filter expression that filters backups listed in the response. + * The expression must specify the field name, a comparison operator, + * and the value that you want to use for filtering. The value must be a + * string, a number, or a boolean. The comparison operator must be + * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is + * roughly synonymous with equality. Filter rules are case insensitive. + * + * The fields eligible for filtering are: + * * `name` + * * `source_table` + * * `state` + * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. By default, each expression is an AND expression. However, + * you can include AND, OR, and NOT expressions explicitly. + * + * Some examples of using filters are: + * + * * `name:"exact"` --> The backup's name is the string "exact". + * * `name:howl` --> The backup's name contains the string "howl". + * * `source_table:prod` + * --> The source_table's name contains the string "prod". + * * `state:CREATING` --> The backup is pending creation. + * * `state:READY` --> The backup is fully created and ready for use. + * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` + * --> The backup name contains the string "howl" and start_time + * of the backup is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB + * @param {string} request.orderBy + * An expression for specifying the sort order of the results of the request. + * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full + * syntax is described at https://aip.dev/132#ordering. + * + * Fields supported are: + * * name + * * source_table + * * expire_time + * * start_time + * * end_time + * * size_bytes + * * state + * + * For example, "start_time". The default sorting order is ascending. + * To specify descending order for the field, a suffix " desc" should + * be appended to the field name. For example, "start_time desc". + * Redundant space characters in the syntax are insigificant. + * + * If order_by is empty, results will be sorted by `start_time` in descending + * order starting from the most recently created backup. + * @param {number} request.pageSize + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @param {string} request.pageToken + * If non-empty, `page_token` should contain a + * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a + * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same + * `filter`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.bigtable.admin.v2.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/bigtable_table_admin.list_backups.js + * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.bigtable.admin.v2.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified appProfile resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} app_profile + * @returns {string} Resource name string. + */ + appProfilePath(project:string,instance:string,appProfile:string) { + return this.pathTemplates.appProfilePathTemplate.render({ + project: project, + instance: instance, + app_profile: appProfile, + }); + } + + /** + * Parse the project from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; + } + + /** + * Parse the instance from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; + } + + /** + * Parse the app_profile from AppProfile resource. + * + * @param {string} appProfileName + * A fully-qualified path representing AppProfile resource. + * @returns {string} A string representing the app_profile. + */ + matchAppProfileFromAppProfileName(appProfileName: string) { + return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; + } + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,instance:string,cluster:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the instance from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).instance; + } + + /** + * Parse the cluster from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).cluster; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified cluster resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @returns {string} Resource name string. + */ + clusterPath(project:string,instance:string,cluster:string) { + return this.pathTemplates.clusterPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + }); + } + + /** + * Parse the project from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the project. + */ + matchProjectFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).project; + } + + /** + * Parse the instance from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).instance; + } + + /** + * Parse the cluster from Cluster resource. + * + * @param {string} clusterName + * A fully-qualified path representing Cluster resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromClusterName(clusterName: string) { + return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; + } + + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified snapshot resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} snapshot + * @returns {string} Resource name string. + */ + snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { + return this.pathTemplates.snapshotPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + snapshot: snapshot, + }); + } + + /** + * Parse the project from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; + } + + /** + * Parse the instance from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; + } + + /** + * Parse the cluster from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).cluster; + } + + /** + * Parse the snapshot from Snapshot resource. + * + * @param {string} snapshotName + * A fully-qualified path representing Snapshot resource. + * @returns {string} A string representing the snapshot. + */ + matchSnapshotFromSnapshotName(snapshotName: string) { + return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; + } + + /** + * Return a fully-qualified table resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} table + * @returns {string} Resource name string. + */ + tablePath(project:string,instance:string,table:string) { + return this.pathTemplates.tablePathTemplate.render({ + project: project, + instance: instance, + table: table, + }); + } + + /** + * Parse the project from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).project; + } + + /** + * Parse the instance from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).instance; + } + + /** + * Parse the table from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the table. + */ + matchTableFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).table; + } + + /** + * 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.bigtableTableAdminStub && !this._terminated) { + return this.bigtableTableAdminStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json new file mode 100644 index 000000000..b6f59ab62 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json @@ -0,0 +1,143 @@ +{ + "interfaces": { + "google.bigtable.admin.v2.BigtableTableAdmin": { + "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 + }, + "264268458a9e88347dbacbd9398202ff5885a40b": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateTable": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateTableFromSnapshot": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTables": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "GetTable": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteTable": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ModifyColumnFamilies": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DropRowRange": { + "timeout_millis": 3600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateConsistencyToken": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "CheckConsistency": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "SnapshotTable": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListSnapshots": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "DeleteSnapshot": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "RestoreTable": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + } + } + } + } +} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json new file mode 100644 index 000000000..1f7e1af50 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json @@ -0,0 +1,7 @@ +[ + "../../protos/google/bigtable/admin/v2/bigtable_instance_admin.proto", + "../../protos/google/bigtable/admin/v2/bigtable_table_admin.proto", + "../../protos/google/bigtable/admin/v2/common.proto", + "../../protos/google/bigtable/admin/v2/instance.proto", + "../../protos/google/bigtable/admin/v2/table.proto" +] diff --git a/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json b/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json new file mode 100644 index 000000000..8faad0b19 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json @@ -0,0 +1,487 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.bigtable.admin.v2", + "libraryPackage": "@google-cloud/bigtable", + "services": { + "BigtableInstanceAdmin": { + "clients": { + "grpc": { + "libraryClient": "BigtableInstanceAdminClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "CreateAppProfile": { + "methods": [ + "createAppProfile" + ] + }, + "GetAppProfile": { + "methods": [ + "getAppProfile" + ] + }, + "DeleteAppProfile": { + "methods": [ + "deleteAppProfile" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "PartialUpdateInstance": { + "methods": [ + "partialUpdateInstance" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "PartialUpdateCluster": { + "methods": [ + "partialUpdateCluster" + ] + }, + "UpdateAppProfile": { + "methods": [ + "updateAppProfile" + ] + }, + "ListAppProfiles": { + "methods": [ + "listAppProfiles", + "listAppProfilesStream", + "listAppProfilesAsync" + ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BigtableInstanceAdminClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "ListInstances": { + "methods": [ + "listInstances" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "CreateAppProfile": { + "methods": [ + "createAppProfile" + ] + }, + "GetAppProfile": { + "methods": [ + "getAppProfile" + ] + }, + "DeleteAppProfile": { + "methods": [ + "deleteAppProfile" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "PartialUpdateInstance": { + "methods": [ + "partialUpdateInstance" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "PartialUpdateCluster": { + "methods": [ + "partialUpdateCluster" + ] + }, + "UpdateAppProfile": { + "methods": [ + "updateAppProfile" + ] + }, + "ListAppProfiles": { + "methods": [ + "listAppProfiles", + "listAppProfilesStream", + "listAppProfilesAsync" + ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] + } + } + } + } + }, + "BigtableTableAdmin": { + "clients": { + "grpc": { + "libraryClient": "BigtableTableAdminClient", + "rpcs": { + "CreateTable": { + "methods": [ + "createTable" + ] + }, + "GetTable": { + "methods": [ + "getTable" + ] + }, + "DeleteTable": { + "methods": [ + "deleteTable" + ] + }, + "ModifyColumnFamilies": { + "methods": [ + "modifyColumnFamilies" + ] + }, + "DropRowRange": { + "methods": [ + "dropRowRange" + ] + }, + "GenerateConsistencyToken": { + "methods": [ + "generateConsistencyToken" + ] + }, + "CheckConsistency": { + "methods": [ + "checkConsistency" + ] + }, + "GetSnapshot": { + "methods": [ + "getSnapshot" + ] + }, + "DeleteSnapshot": { + "methods": [ + "deleteSnapshot" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateTableFromSnapshot": { + "methods": [ + "createTableFromSnapshot" + ] + }, + "SnapshotTable": { + "methods": [ + "snapshotTable" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "RestoreTable": { + "methods": [ + "restoreTable" + ] + }, + "ListTables": { + "methods": [ + "listTables", + "listTablesStream", + "listTablesAsync" + ] + }, + "ListSnapshots": { + "methods": [ + "listSnapshots", + "listSnapshotsStream", + "listSnapshotsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BigtableTableAdminClient", + "rpcs": { + "CreateTable": { + "methods": [ + "createTable" + ] + }, + "GetTable": { + "methods": [ + "getTable" + ] + }, + "DeleteTable": { + "methods": [ + "deleteTable" + ] + }, + "ModifyColumnFamilies": { + "methods": [ + "modifyColumnFamilies" + ] + }, + "DropRowRange": { + "methods": [ + "dropRowRange" + ] + }, + "GenerateConsistencyToken": { + "methods": [ + "generateConsistencyToken" + ] + }, + "CheckConsistency": { + "methods": [ + "checkConsistency" + ] + }, + "GetSnapshot": { + "methods": [ + "getSnapshot" + ] + }, + "DeleteSnapshot": { + "methods": [ + "deleteSnapshot" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateTableFromSnapshot": { + "methods": [ + "createTableFromSnapshot" + ] + }, + "SnapshotTable": { + "methods": [ + "snapshotTable" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "RestoreTable": { + "methods": [ + "restoreTable" + ] + }, + "ListTables": { + "methods": [ + "listTables", + "listTablesStream", + "listTablesAsync" + ] + }, + "ListSnapshots": { + "methods": [ + "listSnapshots", + "listSnapshotsStream", + "listSnapshotsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/admin/v2/src/v2/index.ts b/owl-bot-staging/admin/v2/src/v2/index.ts new file mode 100644 index 000000000..28ff835fe --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {BigtableInstanceAdminClient} from './bigtable_instance_admin_client'; +export {BigtableTableAdminClient} from './bigtable_table_admin_client'; diff --git a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 000000000..a1a5af715 --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const admin = require('@google-cloud/bigtable'); + +function main() { + const bigtableInstanceAdminClient = new admin.BigtableInstanceAdminClient(); + const bigtableTableAdminClient = new admin.BigtableTableAdminClient(); +} + +main(); diff --git a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 000000000..6224e735f --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {BigtableInstanceAdminClient, BigtableTableAdminClient} from '@google-cloud/bigtable'; + +// check that the client class type name can be used +function doStuffWithBigtableInstanceAdminClient(client: BigtableInstanceAdminClient) { + client.close(); +} +function doStuffWithBigtableTableAdminClient(client: BigtableTableAdminClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const bigtableInstanceAdminClient = new BigtableInstanceAdminClient(); + doStuffWithBigtableInstanceAdminClient(bigtableInstanceAdminClient); + // check that the client instance can be created + const bigtableTableAdminClient = new BigtableTableAdminClient(); + doStuffWithBigtableTableAdminClient(bigtableTableAdminClient); +} + +main(); diff --git a/owl-bot-staging/admin/v2/system-test/install.ts b/owl-bot-staging/admin/v2/system-test/install.ts new file mode 100644 index 000000000..8ec452229 --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts b/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts new file mode 100644 index 000000000..df3fa5037 --- /dev/null +++ b/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts @@ -0,0 +1,3152 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as bigtableinstanceadminModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.BigtableInstanceAdminClient', () => { + it('has servicePath', () => { + const servicePath = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableInstanceAdminStub, undefined); + await client.initialize(); + assert(client.bigtableInstanceAdminStub); + }); + + it('has close method for the initialized client', done => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.bigtableInstanceAdminStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableInstanceAdminStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + assert((client.innerApiCalls.getInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); + client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListInstancesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listInstances with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listInstances(request), expectedError); + assert((client.innerApiCalls.listInstances as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listInstances with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listInstances(request), expectedError); + }); + }); + + describe('updateInstance', () => { + it('invokes updateInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.updateInstance = stubSimpleCall(expectedResponse); + const [response] = await client.updateInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + client.innerApiCalls.updateInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateInstance( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateInstance(request), expectedError); + assert((client.innerApiCalls.updateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateInstance(request), expectedError); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteInstance = stubSimpleCall(expectedResponse); + const [response] = await client.deleteInstance(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteInstance with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + assert((client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteInstance with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteInstance(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICluster|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCluster with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCluster(request), expectedError); + assert((client.innerApiCalls.getCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCluster with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listClusters without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); + client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListClustersResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listClusters with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listClusters(request), expectedError); + assert((client.innerApiCalls.listClusters as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listClusters with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listClusters(request), expectedError); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCluster(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCluster with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCluster(request), expectedError); + assert((client.innerApiCalls.deleteCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCluster with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteCluster(request), expectedError); + }); + }); + + describe('createAppProfile', () => { + it('invokes createAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.createAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.createAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.createAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAppProfile( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAppProfile(request), expectedError); + assert((client.innerApiCalls.createAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAppProfile(request), expectedError); + }); + }); + + describe('getAppProfile', () => { + it('invokes getAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.getAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); + client.innerApiCalls.getAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAppProfile( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAppProfile(request), expectedError); + assert((client.innerApiCalls.getAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAppProfile(request), expectedError); + }); + }); + + describe('deleteAppProfile', () => { + it('invokes deleteAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAppProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAppProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAppProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAppProfile( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAppProfile with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAppProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAppProfile(request), expectedError); + assert((client.innerApiCalls.deleteAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAppProfile with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAppProfile(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createInstance with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('partialUpdateInstance', () => { + it('invokes partialUpdateInstance without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.partialUpdateInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateInstance without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partialUpdateInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes partialUpdateInstance with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.partialUpdateInstance(request), expectedError); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateInstance with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); + request.instance = {}; + request.instance.name = ''; + const expectedHeaderRequestParams = "instance.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.partialUpdateInstance(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.partialUpdateInstance as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkPartialUpdateInstanceProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPartialUpdateInstanceProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createCluster(request), expectedError); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateCluster(request), expectedError); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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('partialUpdateCluster', () => { + it('invokes partialUpdateCluster without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(expectedResponse); + const [operation] = await client.partialUpdateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateCluster without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.partialUpdateCluster( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes partialUpdateCluster with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.partialUpdateCluster(request), expectedError); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes partialUpdateCluster with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); + request.cluster = {}; + request.cluster.name = ''; + const expectedHeaderRequestParams = "cluster.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.partialUpdateCluster(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.partialUpdateCluster as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkPartialUpdateClusterProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateClusterProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPartialUpdateClusterProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkPartialUpdateClusterProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateAppProfile', () => { + it('invokes updateAppProfile without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAppProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAppProfile without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateAppProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAppProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAppProfile with call error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateAppProfile(request), expectedError); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAppProfile with LRO error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); + request.appProfile = {}; + request.appProfile.name = ''; + const expectedHeaderRequestParams = "app_profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateAppProfile(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateAppProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateAppProfileProgress without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateAppProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateAppProfileProgress with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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.checkUpdateAppProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAppProfiles', () => { + it('invokes listAppProfiles without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.innerApiCalls.listAppProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listAppProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAppProfiles without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.innerApiCalls.listAppProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAppProfiles( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAppProfiles with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAppProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAppProfiles(request), expectedError); + assert((client.innerApiCalls.listAppProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAppProfilesStream without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAppProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { + 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.listAppProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAppProfilesStream with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAppProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAppProfiles without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), + ]; + client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; + const iterable = client.listAppProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAppProfiles with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAppProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listHotTablets', () => { + it('invokes listHotTablets without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); + const [response] = await client.listHotTablets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHotTablets without error using callback', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHotTablets( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IHotTablet[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listHotTablets with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHotTablets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHotTablets(request), expectedError); + assert((client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHotTabletsStream without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { + 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.listHotTablets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); + assert.strictEqual( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHotTabletsStream with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); + assert.strictEqual( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets without error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + const iterable = client.listHotTabletsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets with error', async () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHotTabletsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('appProfile', () => { + const fakePath = "/rendered/path/appProfile"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + app_profile: "appProfileValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.appProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.appProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('appProfilePath', () => { + const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAppProfileName', () => { + const result = client.matchProjectFromAppProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromAppProfileName', () => { + const result = client.matchInstanceFromAppProfileName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAppProfileFromAppProfileName', () => { + const result = client.matchAppProfileFromAppProfileName(fakePath); + assert.strictEqual(result, "appProfileValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + backup: "backupValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromBackupName', () => { + const result = client.matchInstanceFromBackupName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromBackupName', () => { + const result = client.matchClusterFromBackupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cluster', () => { + const fakePath = "/rendered/path/cluster"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromClusterName', () => { + const result = client.matchInstanceFromClusterName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('hotTablet', () => { + const fakePath = "/rendered/path/hotTablet"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + hot_tablet: "hotTabletValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, "hotTabletValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + 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('snapshot', () => { + const fakePath = "/rendered/path/snapshot"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + snapshot: "snapshotValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.snapshotPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.snapshotPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('snapshotPath', () => { + const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSnapshotName', () => { + const result = client.matchProjectFromSnapshotName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromSnapshotName', () => { + const result = client.matchInstanceFromSnapshotName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromSnapshotName', () => { + const result = client.matchClusterFromSnapshotName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSnapshotFromSnapshotName', () => { + const result = client.matchSnapshotFromSnapshotName(fakePath); + assert.strictEqual(result, "snapshotValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('table', () => { + const fakePath = "/rendered/path/table"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + table: "tableValue", + }; + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tablePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tablePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tablePath', () => { + const result = client.tablePath("projectValue", "instanceValue", "tableValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tablePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTableName', () => { + const result = client.matchProjectFromTableName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromTableName', () => { + const result = client.matchInstanceFromTableName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTableFromTableName', () => { + const result = client.matchTableFromTableName(fakePath); + assert.strictEqual(result, "tableValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts b/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts new file mode 100644 index 000000000..03980510e --- /dev/null +++ b/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts @@ -0,0 +1,3243 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as bigtabletableadminModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.BigtableTableAdminClient', () => { + it('has servicePath', () => { + const servicePath = bigtabletableadminModule.v2.BigtableTableAdminClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = bigtabletableadminModule.v2.BigtableTableAdminClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = bigtabletableadminModule.v2.BigtableTableAdminClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableTableAdminStub, undefined); + await client.initialize(); + assert(client.bigtableTableAdminStub); + }); + + it('has close method for the initialized client', done => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.bigtableTableAdminStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableTableAdminStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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 bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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('createTable', () => { + it('invokes createTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.createTable = stubSimpleCall(expectedResponse); + const [response] = await client.createTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.createTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTable( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTable(request), expectedError); + assert((client.innerApiCalls.createTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createTable(request), expectedError); + }); + }); + + describe('getTable', () => { + it('invokes getTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); + const [response] = await client.getTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.getTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTable( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTable(request), expectedError); + assert((client.innerApiCalls.getTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTable(request), expectedError); + }); + }); + + describe('deleteTable', () => { + it('invokes deleteTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTable(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTable = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTable( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteTable with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTable = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTable(request), expectedError); + assert((client.innerApiCalls.deleteTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTable with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteTable(request), expectedError); + }); + }); + + describe('modifyColumnFamilies', () => { + it('invokes modifyColumnFamilies without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(expectedResponse); + const [response] = await client.modifyColumnFamilies(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes modifyColumnFamilies without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.modifyColumnFamilies( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes modifyColumnFamilies with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.modifyColumnFamilies(request), expectedError); + assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes modifyColumnFamilies with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.modifyColumnFamilies(request), expectedError); + }); + }); + + describe('dropRowRange', () => { + it('invokes dropRowRange without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.dropRowRange = stubSimpleCall(expectedResponse); + const [response] = await client.dropRowRange(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes dropRowRange without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.dropRowRange = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.dropRowRange( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes dropRowRange with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.dropRowRange = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.dropRowRange(request), expectedError); + assert((client.innerApiCalls.dropRowRange as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes dropRowRange with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.dropRowRange(request), expectedError); + }); + }); + + describe('generateConsistencyToken', () => { + it('invokes generateConsistencyToken without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); + client.innerApiCalls.generateConsistencyToken = stubSimpleCall(expectedResponse); + const [response] = await client.generateConsistencyToken(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes generateConsistencyToken without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); + client.innerApiCalls.generateConsistencyToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateConsistencyToken( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes generateConsistencyToken with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateConsistencyToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateConsistencyToken(request), expectedError); + assert((client.innerApiCalls.generateConsistencyToken as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes generateConsistencyToken with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConsistencyToken(request), expectedError); + }); + }); + + describe('checkConsistency', () => { + it('invokes checkConsistency without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); + client.innerApiCalls.checkConsistency = stubSimpleCall(expectedResponse); + const [response] = await client.checkConsistency(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkConsistency without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); + client.innerApiCalls.checkConsistency = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkConsistency( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICheckConsistencyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes checkConsistency with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.checkConsistency = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkConsistency(request), expectedError); + assert((client.innerApiCalls.checkConsistency as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkConsistency with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkConsistency(request), expectedError); + }); + }); + + describe('getSnapshot', () => { + it('invokes getSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); + client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.getSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); + client.innerApiCalls.getSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSnapshot( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSnapshot with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSnapshot(request), expectedError); + assert((client.innerApiCalls.getSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSnapshot with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSnapshot(request), expectedError); + }); + }); + + describe('deleteSnapshot', () => { + it('invokes deleteSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSnapshot(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSnapshot = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSnapshot( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSnapshot with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSnapshot = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSnapshot(request), expectedError); + assert((client.innerApiCalls.deleteSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSnapshot with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSnapshot(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + assert((client.innerApiCalls.getBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); + client.innerApiCalls.updateBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedHeaderRequestParams = "backup.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBackup(request), expectedError); + assert((client.innerApiCalls.updateBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); + request.backup = {}; + request.backup.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBackup(request), expectedError); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteBackup with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + assert((client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBackup with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBackup(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('createTableFromSnapshot', () => { + it('invokes createTableFromSnapshot without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(expectedResponse); + const [operation] = await client.createTableFromSnapshot(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTableFromSnapshot without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTableFromSnapshot( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTableFromSnapshot with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createTableFromSnapshot(request), expectedError); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTableFromSnapshot with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createTableFromSnapshot(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateTableFromSnapshotProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateTableFromSnapshotProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateTableFromSnapshotProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateTableFromSnapshotProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('snapshotTable', () => { + it('invokes snapshotTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.snapshotTable = stubLongRunningCall(expectedResponse); + const [operation] = await client.snapshotTable(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes snapshotTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.snapshotTable = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.snapshotTable( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes snapshotTable with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.snapshotTable(request), expectedError); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes snapshotTable with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.snapshotTable(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.snapshotTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkSnapshotTableProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkSnapshotTableProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSnapshotTableProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkSnapshotTableProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBackup with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createBackup as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreTable', () => { + it('invokes restoreTable without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreTable = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreTable(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreTable without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.restoreTable = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreTable( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes restoreTable with call error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreTable(request), expectedError); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes restoreTable with LRO error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreTable(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.restoreTable as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRestoreTableProgress without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkRestoreTableProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreTableProgress with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + 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.checkRestoreTableProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listTables', () => { + it('invokes listTables without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); + const [response] = await client.listTables(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTables without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.innerApiCalls.listTables = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTables( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTables with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTables = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTables(request), expectedError); + assert((client.innerApiCalls.listTables as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTablesStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.descriptors.page.listTables.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTablesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Table[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { + 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.listTables.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTables, request)); + assert.strictEqual( + (client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTablesStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listTables.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTablesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Table[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTables, request)); + assert.strictEqual( + (client.descriptors.page.listTables.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTables without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), + ]; + client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.ITable[] = []; + const iterable = client.listTablesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTables with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTablesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.ITable[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTables.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSnapshots', () => { + it('invokes listSnapshots without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); + const [response] = await client.listSnapshots(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSnapshots without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.innerApiCalls.listSnapshots = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSnapshots( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSnapshots with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSnapshots = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSnapshots(request), expectedError); + assert((client.innerApiCalls.listSnapshots as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSnapshotsStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSnapshotsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { + 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.listSnapshots.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); + assert.strictEqual( + (client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSnapshotsStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSnapshotsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); + assert.strictEqual( + (client.descriptors.page.listSnapshots.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSnapshots without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), + ]; + client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; + const iterable = client.listSnapshotsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSnapshots with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSnapshotsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBackups with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + assert((client.innerApiCalls.listBackups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Backup[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { + 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.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.Backup[] = []; + stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert.strictEqual( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('appProfile', () => { + const fakePath = "/rendered/path/appProfile"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + app_profile: "appProfileValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.appProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.appProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('appProfilePath', () => { + const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAppProfileName', () => { + const result = client.matchProjectFromAppProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromAppProfileName', () => { + const result = client.matchInstanceFromAppProfileName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAppProfileFromAppProfileName', () => { + const result = client.matchAppProfileFromAppProfileName(fakePath); + assert.strictEqual(result, "appProfileValue"); + assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + backup: "backupValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromBackupName', () => { + const result = client.matchInstanceFromBackupName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromBackupName', () => { + const result = client.matchClusterFromBackupName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('cluster', () => { + const fakePath = "/rendered/path/cluster"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.clusterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromClusterName', () => { + const result = client.matchInstanceFromClusterName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('hotTablet', () => { + const fakePath = "/rendered/path/hotTablet"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + hot_tablet: "hotTabletValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, "hotTabletValue"); + assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('snapshot', () => { + const fakePath = "/rendered/path/snapshot"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + cluster: "clusterValue", + snapshot: "snapshotValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.snapshotPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.snapshotPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('snapshotPath', () => { + const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSnapshotName', () => { + const result = client.matchProjectFromSnapshotName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromSnapshotName', () => { + const result = client.matchInstanceFromSnapshotName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchClusterFromSnapshotName', () => { + const result = client.matchClusterFromSnapshotName(fakePath); + assert.strictEqual(result, "clusterValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSnapshotFromSnapshotName', () => { + const result = client.matchSnapshotFromSnapshotName(fakePath); + assert.strictEqual(result, "snapshotValue"); + assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('table', () => { + const fakePath = "/rendered/path/table"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + table: "tableValue", + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tablePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tablePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tablePath', () => { + const result = client.tablePath("projectValue", "instanceValue", "tableValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tablePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTableName', () => { + const result = client.matchProjectFromTableName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromTableName', () => { + const result = client.matchInstanceFromTableName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTableFromTableName', () => { + const result = client.matchTableFromTableName(fakePath); + assert.strictEqual(result, "tableValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/admin/v2/tsconfig.json b/owl-bot-staging/admin/v2/tsconfig.json new file mode 100644 index 000000000..c78f1c884 --- /dev/null +++ b/owl-bot-staging/admin/v2/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/admin/v2/webpack.config.js b/owl-bot-staging/admin/v2/webpack.config.js new file mode 100644 index 000000000..9b488aad8 --- /dev/null +++ b/owl-bot-staging/admin/v2/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'bigtable', + filename: './bigtable.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore new file mode 100644 index 000000000..cfc348ec4 --- /dev/null +++ b/owl-bot-staging/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json new file mode 100644 index 000000000..782153495 --- /dev/null +++ b/owl-bot-staging/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore new file mode 100644 index 000000000..5d32b2378 --- /dev/null +++ b/owl-bot-staging/v2/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js new file mode 100644 index 000000000..7cb0f52a2 --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/bigtable', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js new file mode 100644 index 000000000..481c522b0 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js new file mode 100644 index 000000000..494e14786 --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md new file mode 100644 index 000000000..c464f1223 --- /dev/null +++ b/owl-bot-staging/v2/README.md @@ -0,0 +1 @@ +Bigtable: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json new file mode 100644 index 000000000..befd23c86 --- /dev/null +++ b/owl-bot-staging/v2/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 000000000..be457bb5e --- /dev/null +++ b/owl-bot-staging/v2/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/bigtable", + "version": "0.1.0", + "description": "Bigtable client for Node.js", + "repository": "googleapis/nodejs-bigtable", + "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 bigtable", + "bigtable", + "bigtable" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto b/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto new file mode 100644 index 000000000..215b573cb --- /dev/null +++ b/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto @@ -0,0 +1,528 @@ +// 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.bigtable.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/api/routing.proto"; +import "google/bigtable/v2/data.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Bigtable.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "BigtableProto"; +option java_package = "com.google.bigtable.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\V2"; +option ruby_package = "Google::Cloud::Bigtable::V2"; +option (google.api.resource_definition) = { + type: "bigtableadmin.googleapis.com/Table" + pattern: "projects/{project}/instances/{instance}/tables/{table}" +}; +option (google.api.resource_definition) = { + type: "bigtableadmin.googleapis.com/Instance" + pattern: "projects/{project}/instances/{instance}" +}; + +// Service for reading from and writing to existing Bigtable tables. +service Bigtable { + option (google.api.default_host) = "bigtable.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/bigtable.data," + "https://www.googleapis.com/auth/bigtable.data.readonly," + "https://www.googleapis.com/auth/cloud-bigtable.data," + "https://www.googleapis.com/auth/cloud-bigtable.data.readonly," + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Streams back the contents of all requested rows in key order, optionally + // applying the same Reader filter to each. Depending on their size, + // rows and cells may be broken up across multiple responses, but + // atomicity of each row will still be preserved. See the + // ReadRowsResponse documentation for details. + rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { + option (google.api.http) = { + post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name"; + option (google.api.method_signature) = "table_name,app_profile_id"; + } + + // Returns a sample of row keys in the table. The returned row keys will + // delimit contiguous sections of the table of approximately equal size, + // which can be used to break up the data for distributed tasks like + // mapreduces. + rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) { + option (google.api.http) = { + get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name"; + option (google.api.method_signature) = "table_name,app_profile_id"; + } + + // Mutates a row atomically. Cells already present in the row are left + // unchanged unless explicitly changed by `mutation`. + rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) { + option (google.api.http) = { + post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name,row_key,mutations"; + option (google.api.method_signature) = "table_name,row_key,mutations,app_profile_id"; + } + + // Mutates multiple rows in a batch. Each individual row is mutated + // atomically as in MutateRow, but the entire batch is not executed + // atomically. + rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) { + option (google.api.http) = { + post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name,entries"; + option (google.api.method_signature) = "table_name,entries,app_profile_id"; + } + + // Mutates a row atomically based on the output of a predicate Reader filter. + rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) { + option (google.api.http) = { + post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations"; + option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations,app_profile_id"; + } + + // Warm up associated instance metadata for this connection. + // This call is not required but may be useful for connection keep-alive. + rpc PingAndWarm(PingAndWarmRequest) returns (PingAndWarmResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/instances/*}:ping" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "name" + path_template: "{name=projects/*/instances/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,app_profile_id"; + } + + // Modifies a row atomically on the server. The method reads the latest + // existing timestamp and value from the specified columns and writes a new + // entry based on pre-defined read/modify/write rules. The new value for the + // timestamp is the greater of the existing timestamp or the current server + // time. The method returns the new contents of all modified cells. + rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (ReadModifyWriteRowResponse) { + option (google.api.http) = { + post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow" + body: "*" + }; + option (google.api.routing) = { + routing_parameters { + field: "table_name" + path_template: "{table_name=projects/*/instances/*/tables/*}" + } + routing_parameters { + field: "app_profile_id" + } + }; + option (google.api.method_signature) = "table_name,row_key,rules"; + option (google.api.method_signature) = "table_name,row_key,rules,app_profile_id"; + } +} + +// Request message for Bigtable.ReadRows. +message ReadRowsRequest { + // Required. The unique name of the table from which to read. + // Values are of the form + // `projects//instances//tables/`. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 5; + + // The row keys and/or ranges to read sequentially. If not specified, reads + // from all rows. + RowSet rows = 2; + + // The filter to apply to the contents of the specified row(s). If unset, + // reads the entirety of each row. + RowFilter filter = 3; + + // The read will stop after committing to N rows' worth of results. The + // default (zero) is to return all results. + int64 rows_limit = 4; +} + +// Response message for Bigtable.ReadRows. +message ReadRowsResponse { + // Specifies a piece of a row's contents returned as part of the read + // response stream. + message CellChunk { + // The row key for this chunk of data. If the row key is empty, + // this CellChunk is a continuation of the same row as the previous + // CellChunk in the response stream, even if that CellChunk was in a + // previous ReadRowsResponse message. + bytes row_key = 1; + + // The column family name for this chunk of data. If this message + // is not present this CellChunk is a continuation of the same column + // family as the previous CellChunk. The empty string can occur as a + // column family name in a response so clients must check + // explicitly for the presence of this message, not just for + // `family_name.value` being non-empty. + google.protobuf.StringValue family_name = 2; + + // The column qualifier for this chunk of data. If this message + // is not present, this CellChunk is a continuation of the same column + // as the previous CellChunk. Column qualifiers may be empty so + // clients must check for the presence of this message, not just + // for `qualifier.value` being non-empty. + google.protobuf.BytesValue qualifier = 3; + + // The cell's stored timestamp, which also uniquely identifies it + // within its column. Values are always expressed in + // microseconds, but individual tables may set a coarser + // granularity to further restrict the allowed values. For + // example, a table which specifies millisecond granularity will + // only allow values of `timestamp_micros` which are multiples of + // 1000. Timestamps are only set in the first CellChunk per cell + // (for cells split into multiple chunks). + int64 timestamp_micros = 4; + + // Labels applied to the cell by a + // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set + // on the first CellChunk per cell. + repeated string labels = 5; + + // The value stored in the cell. Cell values can be split across + // multiple CellChunks. In that case only the value field will be + // set in CellChunks after the first: the timestamp and labels + // will only be present in the first CellChunk, even if the first + // CellChunk came in a previous ReadRowsResponse. + bytes value = 6; + + // If this CellChunk is part of a chunked cell value and this is + // not the final chunk of that cell, value_size will be set to the + // total length of the cell value. The client can use this size + // to pre-allocate memory to hold the full cell value. + int32 value_size = 7; + + // Signals to the client concerning previous CellChunks received. + oneof row_status { + // Indicates that the client should drop all previous chunks for + // `row_key`, as it will be re-read from the beginning. + bool reset_row = 8; + + // Indicates that the client can safely process all previous chunks for + // `row_key`, as its data has been fully read. + bool commit_row = 9; + } + } + + // A collection of a row's contents as part of the read request. + repeated CellChunk chunks = 1; + + // Optionally the server might return the row key of the last row it + // has scanned. The client can use this to construct a more + // efficient retry request if needed: any row keys or portions of + // ranges less than this row key can be dropped from the request. + // This is primarily useful for cases where the server has read a + // lot of data that was filtered out since the last committed row + // key, allowing the client to skip that work on a retry. + bytes last_scanned_row_key = 2; +} + +// Request message for Bigtable.SampleRowKeys. +message SampleRowKeysRequest { + // Required. The unique name of the table from which to sample row keys. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 2; +} + +// Response message for Bigtable.SampleRowKeys. +message SampleRowKeysResponse { + // Sorted streamed sequence of sample row keys in the table. The table might + // have contents before the first row key in the list and after the last one, + // but a key containing the empty string indicates "end of table" and will be + // the last response given, if present. + // Note that row keys in this list may not have ever been written to or read + // from, and users should therefore not make any assumptions about the row key + // structure that are specific to their use case. + bytes row_key = 1; + + // Approximate total storage space used by all rows in the table which precede + // `row_key`. Buffering the contents of all rows between two subsequent + // samples would require space roughly equal to the difference in their + // `offset_bytes` fields. + int64 offset_bytes = 2; +} + +// Request message for Bigtable.MutateRow. +message MutateRowRequest { + // Required. The unique name of the table to which the mutation should be applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 4; + + // Required. The key of the row to which the mutation should be applied. + bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Changes to be atomically applied to the specified row. Entries are applied + // in order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry and at most 100000. + repeated Mutation mutations = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for Bigtable.MutateRow. +message MutateRowResponse { + +} + +// Request message for BigtableService.MutateRows. +message MutateRowsRequest { + // A mutation for a given row. + message Entry { + // The key of the row to which the `mutations` should be applied. + bytes row_key = 1; + + // Required. Changes to be atomically applied to the specified row. Mutations are + // applied in order, meaning that earlier mutations can be masked by + // later ones. + // You must specify at least one mutation. + repeated Mutation mutations = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. The unique name of the table to which the mutations should be applied. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 3; + + // Required. The row keys and corresponding mutations to be applied in bulk. + // Each entry is applied as an atomic mutation, but the entries may be + // applied in arbitrary order (even between entries for the same row). + // At least one entry must be specified, and in total the entries can + // contain at most 100000 mutations. + repeated Entry entries = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for BigtableService.MutateRows. +message MutateRowsResponse { + // The result of applying a passed mutation in the original request. + message Entry { + // The index into the original request's `entries` list of the Entry + // for which a result is being reported. + int64 index = 1; + + // The result of the request Entry identified by `index`. + // Depending on how requests are batched during execution, it is possible + // for one Entry to fail due to an error with another Entry. In the event + // that this occurs, the same error will be reported for both entries. + google.rpc.Status status = 2; + } + + // One or more results for Entries from the batch request. + repeated Entry entries = 1; +} + +// Request message for Bigtable.CheckAndMutateRow. +message CheckAndMutateRowRequest { + // Required. The unique name of the table to which the conditional mutation should be + // applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 7; + + // Required. The key of the row to which the conditional mutation should be applied. + bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // The filter to be applied to the contents of the specified row. Depending + // on whether or not any results are yielded, either `true_mutations` or + // `false_mutations` will be executed. If unset, checks that the row contains + // any values at all. + RowFilter predicate_filter = 6; + + // Changes to be atomically applied to the specified row if `predicate_filter` + // yields at least one cell when applied to `row_key`. Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if `false_mutations` is empty, and at most + // 100000. + repeated Mutation true_mutations = 4; + + // Changes to be atomically applied to the specified row if `predicate_filter` + // does not yield any cells when applied to `row_key`. Entries are applied in + // order, meaning that earlier mutations can be masked by later ones. + // Must contain at least one entry if `true_mutations` is empty, and at most + // 100000. + repeated Mutation false_mutations = 5; +} + +// Response message for Bigtable.CheckAndMutateRow. +message CheckAndMutateRowResponse { + // Whether or not the request's `predicate_filter` yielded any results for + // the specified row. + bool predicate_matched = 1; +} + +// Request message for client connection keep-alive and warming. +message PingAndWarmRequest { + // Required. The unique name of the instance to check permissions for as well as + // respond. Values are of the form `projects//instances/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Instance" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 2; +} + +// Response message for Bigtable.PingAndWarm connection keepalive and warming. +message PingAndWarmResponse { + +} + +// Request message for Bigtable.ReadModifyWriteRow. +message ReadModifyWriteRowRequest { + // Required. The unique name of the table to which the read/modify/write rules should be + // applied. + // Values are of the form + // `projects//instances//tables/
`. + string table_name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + } + ]; + + // This value specifies routing for replication. If not specified, the + // "default" application profile will be used. + string app_profile_id = 4; + + // Required. The key of the row to which the read/modify/write rules should be applied. + bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Rules specifying how the specified row's contents are to be transformed + // into writes. Entries are applied in order, meaning that earlier rules will + // affect the results of later ones. + repeated ReadModifyWriteRule rules = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for Bigtable.ReadModifyWriteRow. +message ReadModifyWriteRowResponse { + // A Row containing the new contents of all cells modified by the request. + Row row = 1; +} diff --git a/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto b/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto new file mode 100644 index 000000000..9e5a05c2e --- /dev/null +++ b/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto @@ -0,0 +1,535 @@ +// 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.bigtable.v2; + +option csharp_namespace = "Google.Cloud.Bigtable.V2"; +option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; +option java_multiple_files = true; +option java_outer_classname = "DataProto"; +option java_package = "com.google.bigtable.v2"; +option php_namespace = "Google\\Cloud\\Bigtable\\V2"; +option ruby_package = "Google::Cloud::Bigtable::V2"; + +// Specifies the complete (requested) contents of a single row of a table. +// Rows which exceed 256MiB in size cannot be read in full. +message Row { + // The unique key which identifies this row within its table. This is the same + // key that's used to identify the row in, for example, a MutateRowRequest. + // May contain any non-empty byte string up to 4KiB in length. + bytes key = 1; + + // May be empty, but only if the entire row is empty. + // The mutual ordering of column families is not specified. + repeated Family families = 2; +} + +// Specifies (some of) the contents of a single row/column family intersection +// of a table. +message Family { + // The unique key which identifies this family within its row. This is the + // same key that's used to identify the family in, for example, a RowFilter + // which sets its "family_name_regex_filter" field. + // Must match `[-_.a-zA-Z0-9]+`, except that AggregatingRowProcessors may + // produce cells in a sentinel family with an empty name. + // Must be no greater than 64 characters in length. + string name = 1; + + // Must not be empty. Sorted in order of increasing "qualifier". + repeated Column columns = 2; +} + +// Specifies (some of) the contents of a single row/column intersection of a +// table. +message Column { + // The unique key which identifies this column within its family. This is the + // same key that's used to identify the column in, for example, a RowFilter + // which sets its `column_qualifier_regex_filter` field. + // May contain any byte string, including the empty string, up to 16kiB in + // length. + bytes qualifier = 1; + + // Must not be empty. Sorted in order of decreasing "timestamp_micros". + repeated Cell cells = 2; +} + +// Specifies (some of) the contents of a single row/column/timestamp of a table. +message Cell { + // The cell's stored timestamp, which also uniquely identifies it within + // its column. + // Values are always expressed in microseconds, but individual tables may set + // a coarser granularity to further restrict the allowed values. For + // example, a table which specifies millisecond granularity will only allow + // values of `timestamp_micros` which are multiples of 1000. + int64 timestamp_micros = 1; + + // The value stored in the cell. + // May contain any byte string, including the empty string, up to 100MiB in + // length. + bytes value = 2; + + // Labels applied to the cell by a [RowFilter][google.bigtable.v2.RowFilter]. + repeated string labels = 3; +} + +// Specifies a contiguous range of rows. +message RowRange { + // The row key at which to start the range. + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_key { + // Used when giving an inclusive lower bound for the range. + bytes start_key_closed = 1; + + // Used when giving an exclusive lower bound for the range. + bytes start_key_open = 2; + } + + // The row key at which to end the range. + // If neither field is set, interpreted as the infinite row key, exclusive. + oneof end_key { + // Used when giving an exclusive upper bound for the range. + bytes end_key_open = 3; + + // Used when giving an inclusive upper bound for the range. + bytes end_key_closed = 4; + } +} + +// Specifies a non-contiguous set of rows. +message RowSet { + // Single rows included in the set. + repeated bytes row_keys = 1; + + // Contiguous row ranges included in the set. + repeated RowRange row_ranges = 2; +} + +// Specifies a contiguous range of columns within a single column family. +// The range spans from <column_family>:<start_qualifier> to +// <column_family>:<end_qualifier>, where both bounds can be either +// inclusive or exclusive. +message ColumnRange { + // The name of the column family within which this range falls. + string family_name = 1; + + // The column qualifier at which to start the range (within `column_family`). + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_qualifier { + // Used when giving an inclusive lower bound for the range. + bytes start_qualifier_closed = 2; + + // Used when giving an exclusive lower bound for the range. + bytes start_qualifier_open = 3; + } + + // The column qualifier at which to end the range (within `column_family`). + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_qualifier { + // Used when giving an inclusive upper bound for the range. + bytes end_qualifier_closed = 4; + + // Used when giving an exclusive upper bound for the range. + bytes end_qualifier_open = 5; + } +} + +// Specified a contiguous range of microsecond timestamps. +message TimestampRange { + // Inclusive lower bound. If left empty, interpreted as 0. + int64 start_timestamp_micros = 1; + + // Exclusive upper bound. If left empty, interpreted as infinity. + int64 end_timestamp_micros = 2; +} + +// Specifies a contiguous range of raw byte values. +message ValueRange { + // The value at which to start the range. + // If neither field is set, interpreted as the empty string, inclusive. + oneof start_value { + // Used when giving an inclusive lower bound for the range. + bytes start_value_closed = 1; + + // Used when giving an exclusive lower bound for the range. + bytes start_value_open = 2; + } + + // The value at which to end the range. + // If neither field is set, interpreted as the infinite string, exclusive. + oneof end_value { + // Used when giving an inclusive upper bound for the range. + bytes end_value_closed = 3; + + // Used when giving an exclusive upper bound for the range. + bytes end_value_open = 4; + } +} + +// Takes a row as input and produces an alternate view of the row based on +// specified rules. For example, a RowFilter might trim down a row to include +// just the cells from columns matching a given regular expression, or might +// return all the cells of a row but not their values. More complicated filters +// can be composed out of these components to express requests such as, "within +// every column of a particular family, give just the two most recent cells +// which are older than timestamp X." +// +// There are two broad categories of RowFilters (true filters and transformers), +// as well as two ways to compose simple filters into more complex ones +// (chains and interleaves). They work as follows: +// +// * True filters alter the input row by excluding some of its cells wholesale +// from the output row. An example of a true filter is the `value_regex_filter`, +// which excludes cells whose values don't match the specified pattern. All +// regex true filters use RE2 syntax (https://github.com/google/re2/wiki/Syntax) +// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An +// important point to keep in mind is that `RE2(.)` is equivalent by default to +// `RE2([^\n])`, meaning that it does not match newlines. When attempting to +// match an arbitrary byte, you should therefore use the escape sequence `\C`, +// which may need to be further escaped as `\\C` in your client language. +// +// * Transformers alter the input row by changing the values of some of its +// cells in the output, without excluding them completely. Currently, the only +// supported transformer is the `strip_value_transformer`, which replaces every +// cell's value with the empty string. +// +// * Chains and interleaves are described in more detail in the +// RowFilter.Chain and RowFilter.Interleave documentation. +// +// The total serialized size of a RowFilter message must not +// exceed 20480 bytes, and RowFilters may not be nested within each other +// (in Chains or Interleaves) to a depth of more than 20. +message RowFilter { + // A RowFilter which sends rows through several RowFilters in sequence. + message Chain { + // The elements of "filters" are chained together to process the input row: + // in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row + // The full chain is executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which sends each row to each of several component + // RowFilters and interleaves the results. + message Interleave { + // The elements of "filters" all process a copy of the input row, and the + // results are pooled, sorted, and combined into a single output row. + // If multiple cells are produced with the same column and timestamp, + // they will all appear in the output row in an unspecified mutual order. + // Consider the following example, with three filters: + // + // input row + // | + // ----------------------------------------------------- + // | | | + // f(0) f(1) f(2) + // | | | + // 1: foo,bar,10,x foo,bar,10,z far,bar,7,a + // 2: foo,blah,11,z far,blah,5,x far,blah,5,x + // | | | + // ----------------------------------------------------- + // | + // 1: foo,bar,10,z // could have switched with #2 + // 2: foo,bar,10,x // could have switched with #1 + // 3: foo,blah,11,z + // 4: far,bar,7,a + // 5: far,blah,5,x // identical to #6 + // 6: far,blah,5,x // identical to #5 + // + // All interleaved filters are executed atomically. + repeated RowFilter filters = 1; + } + + // A RowFilter which evaluates one of two possible RowFilters, depending on + // whether or not a predicate RowFilter outputs any cells from the input row. + // + // IMPORTANT NOTE: The predicate filter does not execute atomically with the + // true and false filters, which may lead to inconsistent or unexpected + // results. Additionally, Condition filters have poor performance, especially + // when filters are set for the false condition. + message Condition { + // If `predicate_filter` outputs any cells, then `true_filter` will be + // evaluated on the input row. Otherwise, `false_filter` will be evaluated. + RowFilter predicate_filter = 1; + + // The filter to apply to the input row if `predicate_filter` returns any + // results. If not provided, no results will be returned in the true case. + RowFilter true_filter = 2; + + // The filter to apply to the input row if `predicate_filter` does not + // return any results. If not provided, no results will be returned in the + // false case. + RowFilter false_filter = 3; + } + + // Which of the possible RowFilter types to apply. If none are set, this + // RowFilter returns all cells in the input row. + oneof filter { + // Applies several RowFilters to the data in sequence, progressively + // narrowing the results. + Chain chain = 1; + + // Applies several RowFilters to the data in parallel and combines the + // results. + Interleave interleave = 2; + + // Applies one of two possible RowFilters to the data based on the output of + // a predicate RowFilter. + Condition condition = 3; + + // ADVANCED USE ONLY. + // Hook for introspection into the RowFilter. Outputs all cells directly to + // the output of the read rather than to any parent filter. Consider the + // following example: + // + // Chain( + // FamilyRegex("A"), + // Interleave( + // All(), + // Chain(Label("foo"), Sink()) + // ), + // QualifierRegex("B") + // ) + // + // A,A,1,w + // A,B,2,x + // B,B,4,z + // | + // FamilyRegex("A") + // | + // A,A,1,w + // A,B,2,x + // | + // +------------+-------------+ + // | | + // All() Label(foo) + // | | + // A,A,1,w A,A,1,w,labels:[foo] + // A,B,2,x A,B,2,x,labels:[foo] + // | | + // | Sink() --------------+ + // | | | + // +------------+ x------+ A,A,1,w,labels:[foo] + // | A,B,2,x,labels:[foo] + // A,A,1,w | + // A,B,2,x | + // | | + // QualifierRegex("B") | + // | | + // A,B,2,x | + // | | + // +--------------------------------+ + // | + // A,A,1,w,labels:[foo] + // A,B,2,x,labels:[foo] // could be switched + // A,B,2,x // could be switched + // + // Despite being excluded by the qualifier filter, a copy of every cell + // that reaches the sink is present in the final result. + // + // As with an [Interleave][google.bigtable.v2.RowFilter.Interleave], + // duplicate cells are possible, and appear in an unspecified mutual order. + // In this case we have a duplicate with column "A:B" and timestamp 2, + // because one copy passed through the all filter while the other was + // passed through the label and sink. Note that one copy has label "foo", + // while the other does not. + // + // Cannot be used within the `predicate_filter`, `true_filter`, or + // `false_filter` of a [Condition][google.bigtable.v2.RowFilter.Condition]. + bool sink = 16; + + // Matches all cells, regardless of input. Functionally equivalent to + // leaving `filter` unset, but included for completeness. + bool pass_all_filter = 17; + + // Does not match any cells, regardless of input. Useful for temporarily + // disabling just part of a filter. + bool block_all_filter = 18; + + // Matches only cells from rows whose keys satisfy the given RE2 regex. In + // other words, passes through the entire row when the key matches, and + // otherwise produces an empty row. + // Note that, since row keys can contain arbitrary bytes, the `\C` escape + // sequence must be used if a true wildcard is desired. The `.` character + // will not match the new line character `\n`, which may be present in a + // binary key. + bytes row_key_regex_filter = 4; + + // Matches all cells from a row with probability p, and matches no cells + // from the row with probability 1-p. + double row_sample_filter = 14; + + // Matches only cells from columns whose families satisfy the given RE2 + // regex. For technical reasons, the regex must not contain the `:` + // character, even if it is not being used as a literal. + // Note that, since column families cannot contain the new line character + // `\n`, it is sufficient to use `.` as a full wildcard when matching + // column family names. + string family_name_regex_filter = 5; + + // Matches only cells from columns whose qualifiers satisfy the given RE2 + // regex. + // Note that, since column qualifiers can contain arbitrary bytes, the `\C` + // escape sequence must be used if a true wildcard is desired. The `.` + // character will not match the new line character `\n`, which may be + // present in a binary qualifier. + bytes column_qualifier_regex_filter = 6; + + // Matches only cells from columns within the given range. + ColumnRange column_range_filter = 7; + + // Matches only cells with timestamps within the given range. + TimestampRange timestamp_range_filter = 8; + + // Matches only cells with values that satisfy the given regular expression. + // Note that, since cell values can contain arbitrary bytes, the `\C` escape + // sequence must be used if a true wildcard is desired. The `.` character + // will not match the new line character `\n`, which may be present in a + // binary value. + bytes value_regex_filter = 9; + + // Matches only cells with values that fall within the given range. + ValueRange value_range_filter = 15; + + // Skips the first N cells of each row, matching all subsequent cells. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_offset_filter = 10; + + // Matches only the first N cells of each row. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_row_limit_filter = 11; + + // Matches only the most recent N cells within each column. For example, + // if N=2, this filter would match column `foo:bar` at timestamps 10 and 9, + // skip all earlier cells in `foo:bar`, and then begin matching again in + // column `foo:bar2`. + // If duplicate cells are present, as is possible when using an Interleave, + // each copy of the cell is counted separately. + int32 cells_per_column_limit_filter = 12; + + // Replaces each cell's value with the empty string. + bool strip_value_transformer = 13; + + // Applies the given label to all cells in the output row. This allows + // the client to determine which results were produced from which part of + // the filter. + // + // Values must be at most 15 characters in length, and match the RE2 + // pattern `[a-z0-9\\-]+` + // + // Due to a technical limitation, it is not currently possible to apply + // multiple labels to a cell. As a result, a Chain may have no more than + // one sub-filter which contains a `apply_label_transformer`. It is okay for + // an Interleave to contain multiple `apply_label_transformers`, as they + // will be applied to separate copies of the input. This may be relaxed in + // the future. + string apply_label_transformer = 19; + } +} + +// Specifies a particular change to be made to the contents of a row. +message Mutation { + // A Mutation which sets the value of the specified cell. + message SetCell { + // The name of the family into which new data should be written. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column into which new data should be written. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The timestamp of the cell into which new data should be written. + // Use -1 for current Bigtable server time. + // Otherwise, the client should set this value itself, noting that the + // default value is a timestamp of zero if the field is left unspecified. + // Values must match the granularity of the table (e.g. micros, millis). + int64 timestamp_micros = 3; + + // The value to be written into the specified cell. + bytes value = 4; + } + + // A Mutation which deletes cells from the specified column, optionally + // restricting the deletions to a given timestamp range. + message DeleteFromColumn { + // The name of the family from which cells should be deleted. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column from which cells should be deleted. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The range of timestamps within which cells should be deleted. + TimestampRange time_range = 3; + } + + // A Mutation which deletes all cells from the specified column family. + message DeleteFromFamily { + // The name of the family from which cells should be deleted. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + } + + // A Mutation which deletes all cells from the containing row. + message DeleteFromRow { + + } + + // Which of the possible Mutation types to apply. + oneof mutation { + // Set a cell's value. + SetCell set_cell = 1; + + // Deletes cells from a column. + DeleteFromColumn delete_from_column = 2; + + // Deletes cells from a column family. + DeleteFromFamily delete_from_family = 3; + + // Deletes cells from the entire row. + DeleteFromRow delete_from_row = 4; + } +} + +// Specifies an atomic read/modify/write operation on the latest value of the +// specified column. +message ReadModifyWriteRule { + // The name of the family to which the read/modify/write should be applied. + // Must match `[-_.a-zA-Z0-9]+` + string family_name = 1; + + // The qualifier of the column to which the read/modify/write should be + // applied. + // Can be any byte string, including the empty string. + bytes column_qualifier = 2; + + // The rule used to determine the column's new latest value from its current + // latest value. + oneof rule { + // Rule specifying that `append_value` be appended to the existing value. + // If the targeted cell is unset, it will be treated as containing the + // empty string. + bytes append_value = 3; + + // Rule specifying that `increment_amount` be added to the existing value. + // If the targeted cell is unset, it will be treated as containing a zero. + // Otherwise, the targeted cell must contain an 8-byte value (interpreted + // as a 64-bit big-endian signed integer), or the entire request will fail. + int64 increment_amount = 4; + } +} diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js new file mode 100644 index 000000000..281ac8562 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js @@ -0,0 +1,98 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName, rowKey) { + // [START bigtable_v2_generated_Bigtable_CheckAndMutateRow_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to which the conditional mutation should be + * applied. + * Values are of the form + * `projects//instances//tables/
`. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + /** + * Required. The key of the row to which the conditional mutation should be applied. + */ + // const rowKey = 'Buffer.from('string')' + /** + * The filter to be applied to the contents of the specified row. Depending + * on whether or not any results are yielded, either `true_mutations` or + * `false_mutations` will be executed. If unset, checks that the row contains + * any values at all. + */ + // const predicateFilter = {} + /** + * Changes to be atomically applied to the specified row if `predicate_filter` + * yields at least one cell when applied to `row_key`. Entries are applied in + * order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry if `false_mutations` is empty, and at most + * 100000. + */ + // const trueMutations = 1234 + /** + * Changes to be atomically applied to the specified row if `predicate_filter` + * does not yield any cells when applied to `row_key`. Entries are applied in + * order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry if `true_mutations` is empty, and at most + * 100000. + */ + // const falseMutations = 1234 + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callCheckAndMutateRow() { + // Construct request + const request = { + tableName, + rowKey, + }; + + // Run request + const response = await bigtableClient.checkAndMutateRow(request); + console.log(response); + } + + callCheckAndMutateRow(); + // [END bigtable_v2_generated_Bigtable_CheckAndMutateRow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js new file mode 100644 index 000000000..13e45188d --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName, rowKey, mutations) { + // [START bigtable_v2_generated_Bigtable_MutateRow_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to which the mutation should be applied. + * Values are of the form + * `projects//instances//tables/
`. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + /** + * Required. The key of the row to which the mutation should be applied. + */ + // const rowKey = 'Buffer.from('string')' + /** + * Required. Changes to be atomically applied to the specified row. Entries are applied + * in order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry and at most 100000. + */ + // const mutations = 1234 + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callMutateRow() { + // Construct request + const request = { + tableName, + rowKey, + mutations, + }; + + // Run request + const response = await bigtableClient.mutateRow(request); + console.log(response); + } + + callMutateRow(); + // [END bigtable_v2_generated_Bigtable_MutateRow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js new file mode 100644 index 000000000..3be0d8a4d --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName, entries) { + // [START bigtable_v2_generated_Bigtable_MutateRows_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to which the mutations should be applied. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + /** + * Required. The row keys and corresponding mutations to be applied in bulk. + * Each entry is applied as an atomic mutation, but the entries may be + * applied in arbitrary order (even between entries for the same row). + * At least one entry must be specified, and in total the entries can + * contain at most 100000 mutations. + */ + // const entries = 1234 + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callMutateRows() { + // Construct request + const request = { + tableName, + entries, + }; + + // Run request + const stream = await bigtableClient.mutateRows(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callMutateRows(); + // [END bigtable_v2_generated_Bigtable_MutateRows_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js new file mode 100644 index 000000000..c68e61757 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(name) { + // [START bigtable_v2_generated_Bigtable_PingAndWarm_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the instance to check permissions for as well as + * respond. Values are of the form `projects//instances/`. + */ + // const name = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callPingAndWarm() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await bigtableClient.pingAndWarm(request); + console.log(response); + } + + callPingAndWarm(); + // [END bigtable_v2_generated_Bigtable_PingAndWarm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js new file mode 100644 index 000000000..ae7934b8f --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName, rowKey, rules) { + // [START bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table to which the read/modify/write rules should be + * applied. + * Values are of the form + * `projects//instances//tables/
`. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + /** + * Required. The key of the row to which the read/modify/write rules should be applied. + */ + // const rowKey = 'Buffer.from('string')' + /** + * Required. Rules specifying how the specified row's contents are to be transformed + * into writes. Entries are applied in order, meaning that earlier rules will + * affect the results of later ones. + */ + // const rules = 1234 + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callReadModifyWriteRow() { + // Construct request + const request = { + tableName, + rowKey, + rules, + }; + + // Run request + const response = await bigtableClient.readModifyWriteRow(request); + console.log(response); + } + + callReadModifyWriteRow(); + // [END bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js new file mode 100644 index 000000000..9b5354905 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName) { + // [START bigtable_v2_generated_Bigtable_ReadRows_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table from which to read. + * Values are of the form + * `projects//instances//tables/
`. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + /** + * The row keys and/or ranges to read sequentially. If not specified, reads + * from all rows. + */ + // const rows = {} + /** + * The filter to apply to the contents of the specified row(s). If unset, + * reads the entirety of each row. + */ + // const filter = {} + /** + * The read will stop after committing to N rows' worth of results. The + * default (zero) is to return all results. + */ + // const rowsLimit = 1234 + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callReadRows() { + // Construct request + const request = { + tableName, + }; + + // Run request + const stream = await bigtableClient.readRows(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callReadRows(); + // [END bigtable_v2_generated_Bigtable_ReadRows_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js new file mode 100644 index 000000000..d7364fe17 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + /** + * NOTE: This sample is autogenerated, but this library contains handwritten + * samples that are the recommended way to use this library. Please refer to + * samples outside of the generated/ folder for these recommendations. + */ +'use strict'; + +function main(tableName) { + // [START bigtable_v2_generated_Bigtable_SampleRowKeys_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The unique name of the table from which to sample row keys. + * Values are of the form + * `projects//instances//tables/
`. + */ + // const tableName = 'abc123' + /** + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + */ + // const appProfileId = 'abc123' + + // Imports the Bigtable library + const {BigtableClient} = require('@google-cloud/bigtable').v2; + + // Instantiates a client + const bigtableClient = new BigtableClient(); + + async function callSampleRowKeys() { + // Construct request + const request = { + tableName, + }; + + // Run request + const stream = await bigtableClient.sampleRowKeys(request); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + } + + callSampleRowKeys(); + // [END bigtable_v2_generated_Bigtable_SampleRowKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json new file mode 100644 index 000000000..03d917cb9 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json @@ -0,0 +1,371 @@ +{ + "clientLibrary": { + "name": "nodejs-bigtable", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.bigtable.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "bigtable_v2_generated_Bigtable_ReadRows_async", + "title": "bigtable readRows Sample", + "origin": "API_DEFINITION", + "description": " Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each. Depending on their size, rows and cells may be broken up across multiple responses, but atomicity of each row will still be preserved. See the ReadRowsResponse documentation for details.", + "canonical": false, + "file": "bigtable.read_rows.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReadRows", + "fullName": "google.bigtable.v2.Bigtable.ReadRows", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "rows", + "type": ".google.bigtable.v2.RowSet" + }, + { + "name": "filter", + "type": ".google.bigtable.v2.RowFilter" + }, + { + "name": "rows_limit", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.bigtable.v2.ReadRowsResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "ReadRows", + "fullName": "google.bigtable.v2.Bigtable.ReadRows", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_SampleRowKeys_async", + "title": "bigtable sampleRowKeys Sample", + "origin": "API_DEFINITION", + "description": " Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.", + "canonical": false, + "file": "bigtable.sample_row_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SampleRowKeys", + "fullName": "google.bigtable.v2.Bigtable.SampleRowKeys", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.v2.SampleRowKeysResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "SampleRowKeys", + "fullName": "google.bigtable.v2.Bigtable.SampleRowKeys", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_MutateRow_async", + "title": "bigtable mutateRow Sample", + "origin": "API_DEFINITION", + "description": " Mutates a row atomically. Cells already present in the row are left unchanged unless explicitly changed by `mutation`.", + "canonical": false, + "file": "bigtable.mutate_row.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MutateRow", + "fullName": "google.bigtable.v2.Bigtable.MutateRow", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "row_key", + "type": "TYPE_BYTES" + }, + { + "name": "mutations", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.v2.MutateRowResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "MutateRow", + "fullName": "google.bigtable.v2.Bigtable.MutateRow", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_MutateRows_async", + "title": "bigtable mutateRows Sample", + "origin": "API_DEFINITION", + "description": " Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.", + "canonical": false, + "file": "bigtable.mutate_rows.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MutateRows", + "fullName": "google.bigtable.v2.Bigtable.MutateRows", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "entries", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.v2.MutateRowsResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "MutateRows", + "fullName": "google.bigtable.v2.Bigtable.MutateRows", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_CheckAndMutateRow_async", + "title": "bigtable checkAndMutateRow Sample", + "origin": "API_DEFINITION", + "description": " Mutates a row atomically based on the output of a predicate Reader filter.", + "canonical": false, + "file": "bigtable.check_and_mutate_row.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CheckAndMutateRow", + "fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "row_key", + "type": "TYPE_BYTES" + }, + { + "name": "predicate_filter", + "type": ".google.bigtable.v2.RowFilter" + }, + { + "name": "true_mutations", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "false_mutations", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.v2.CheckAndMutateRowResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "CheckAndMutateRow", + "fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_PingAndWarm_async", + "title": "bigtable pingAndWarm Sample", + "origin": "API_DEFINITION", + "description": " Warm up associated instance metadata for this connection. This call is not required but may be useful for connection keep-alive.", + "canonical": false, + "file": "bigtable.ping_and_warm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PingAndWarm", + "fullName": "google.bigtable.v2.Bigtable.PingAndWarm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.v2.PingAndWarmResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "PingAndWarm", + "fullName": "google.bigtable.v2.Bigtable.PingAndWarm", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + }, + { + "regionTag": "bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async", + "title": "bigtable readModifyWriteRow Sample", + "origin": "API_DEFINITION", + "description": " Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.", + "canonical": false, + "file": "bigtable.read_modify_write_row.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 29, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReadModifyWriteRow", + "fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow", + "async": true, + "parameters": [ + { + "name": "table_name", + "type": "TYPE_STRING" + }, + { + "name": "app_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "row_key", + "type": "TYPE_BYTES" + }, + { + "name": "rules", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.bigtable.v2.ReadModifyWriteRowResponse", + "client": { + "shortName": "BigtableClient", + "fullName": "google.bigtable.v2.BigtableClient" + }, + "method": { + "shortName": "ReadModifyWriteRow", + "fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow", + "service": { + "shortName": "Bigtable", + "fullName": "google.bigtable.v2.Bigtable" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 000000000..b97a7779f --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const BigtableClient = v2.BigtableClient; +type BigtableClient = v2.BigtableClient; +export {v2, BigtableClient}; +export default {v2, BigtableClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v2/src/v2/bigtable_client.ts b/owl-bot-staging/v2/src/v2/bigtable_client.ts new file mode 100644 index 000000000..4f81201cc --- /dev/null +++ b/owl-bot-staging/v2/src/v2/bigtable_client.ts @@ -0,0 +1,925 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GoogleError} from 'google-gax'; + +import { PassThrough } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/bigtable_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './bigtable_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for reading from and writing to existing Bigtable tables. + * @class + * @memberof v2 + */ +export class BigtableClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + bigtableStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BigtableClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof BigtableClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}' + ), + tablePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/tables/{table}' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + readRows: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING), + sampleRowKeys: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING), + mutateRows: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.bigtable.v2.Bigtable', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.bigtableStub) { + return this.bigtableStub; + } + + // Put together the "service stub" for + // google.bigtable.v2.Bigtable. + this.bigtableStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.bigtable.v2.Bigtable') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.bigtable.v2.Bigtable, + 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 bigtableStubMethods = + ['readRows', 'sampleRowKeys', 'mutateRow', 'mutateRows', 'checkAndMutateRow', 'pingAndWarm', 'readModifyWriteRow']; + for (const methodName of bigtableStubMethods) { + const callPromise = this.bigtableStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new GoogleError('The client has already been closed.')); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.bigtableStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'bigtable.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 'bigtable.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/bigtable.data', + 'https://www.googleapis.com/auth/bigtable.data.readonly', + 'https://www.googleapis.com/auth/cloud-bigtable.data', + 'https://www.googleapis.com/auth/cloud-bigtable.data.readonly', + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only' + ]; + } + + 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 -- + // ------------------- +/** + * Mutates a row atomically. Cells already present in the row are left + * unchanged unless explicitly changed by `mutation`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table to which the mutation should be applied. + * Values are of the form + * `projects//instances//tables/
`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {Buffer} request.rowKey + * Required. The key of the row to which the mutation should be applied. + * @param {number[]} request.mutations + * Required. Changes to be atomically applied to the specified row. Entries are applied + * in order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry and at most 100000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MutateRowResponse]{@link google.bigtable.v2.MutateRowResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + */ + mutateRow( + request?: protos.google.bigtable.v2.IMutateRowRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|undefined, {}|undefined + ]>; + mutateRow( + request: protos.google.bigtable.v2.IMutateRowRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|null|undefined, + {}|null|undefined>): void; + mutateRow( + request: protos.google.bigtable.v2.IMutateRowRequest, + callback: Callback< + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|null|undefined, + {}|null|undefined>): void; + mutateRow( + request?: protos.google.bigtable.v2.IMutateRowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.v2.IMutateRowResponse, + protos.google.bigtable.v2.IMutateRowRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.mutateRow(request, options, callback); + } +/** + * Mutates a row atomically based on the output of a predicate Reader filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table to which the conditional mutation should be + * applied. + * Values are of the form + * `projects//instances//tables/
`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {Buffer} request.rowKey + * Required. The key of the row to which the conditional mutation should be applied. + * @param {google.bigtable.v2.RowFilter} request.predicateFilter + * The filter to be applied to the contents of the specified row. Depending + * on whether or not any results are yielded, either `true_mutations` or + * `false_mutations` will be executed. If unset, checks that the row contains + * any values at all. + * @param {number[]} request.trueMutations + * Changes to be atomically applied to the specified row if `predicate_filter` + * yields at least one cell when applied to `row_key`. Entries are applied in + * order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry if `false_mutations` is empty, and at most + * 100000. + * @param {number[]} request.falseMutations + * Changes to be atomically applied to the specified row if `predicate_filter` + * does not yield any cells when applied to `row_key`. Entries are applied in + * order, meaning that earlier mutations can be masked by later ones. + * Must contain at least one entry if `true_mutations` is empty, and at most + * 100000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CheckAndMutateRowResponse]{@link google.bigtable.v2.CheckAndMutateRowResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + */ + checkAndMutateRow( + request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|undefined, {}|undefined + ]>; + checkAndMutateRow( + request: protos.google.bigtable.v2.ICheckAndMutateRowRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, + {}|null|undefined>): void; + checkAndMutateRow( + request: protos.google.bigtable.v2.ICheckAndMutateRowRequest, + callback: Callback< + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, + {}|null|undefined>): void; + checkAndMutateRow( + request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.v2.ICheckAndMutateRowResponse, + protos.google.bigtable.v2.ICheckAndMutateRowRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.checkAndMutateRow(request, options, callback); + } +/** + * Warm up associated instance metadata for this connection. + * This call is not required but may be useful for connection keep-alive. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique name of the instance to check permissions for as well as + * respond. Values are of the form `projects//instances/`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PingAndWarmResponse]{@link google.bigtable.v2.PingAndWarmResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + */ + pingAndWarm( + request?: protos.google.bigtable.v2.IPingAndWarmRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|undefined, {}|undefined + ]>; + pingAndWarm( + request: protos.google.bigtable.v2.IPingAndWarmRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, + {}|null|undefined>): void; + pingAndWarm( + request: protos.google.bigtable.v2.IPingAndWarmRequest, + callback: Callback< + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, + {}|null|undefined>): void; + pingAndWarm( + request?: protos.google.bigtable.v2.IPingAndWarmRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.v2.IPingAndWarmResponse, + protos.google.bigtable.v2.IPingAndWarmRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.name !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+').test(request.name!)){ + Object.assign(routingParameter, { name: request.name!.match(RegExp('(?projects/[^/]+/instances/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.pingAndWarm(request, options, callback); + } +/** + * Modifies a row atomically on the server. The method reads the latest + * existing timestamp and value from the specified columns and writes a new + * entry based on pre-defined read/modify/write rules. The new value for the + * timestamp is the greater of the existing timestamp or the current server + * time. The method returns the new contents of all modified cells. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table to which the read/modify/write rules should be + * applied. + * Values are of the form + * `projects//instances//tables/
`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {Buffer} request.rowKey + * Required. The key of the row to which the read/modify/write rules should be applied. + * @param {number[]} request.rules + * Required. Rules specifying how the specified row's contents are to be transformed + * into writes. Entries are applied in order, meaning that earlier rules will + * affect the results of later ones. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReadModifyWriteRowResponse]{@link google.bigtable.v2.ReadModifyWriteRowResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + */ + readModifyWriteRow( + request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest, + options?: CallOptions): + Promise<[ + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|undefined, {}|undefined + ]>; + readModifyWriteRow( + request: protos.google.bigtable.v2.IReadModifyWriteRowRequest, + options: CallOptions, + callback: Callback< + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, + {}|null|undefined>): void; + readModifyWriteRow( + request: protos.google.bigtable.v2.IReadModifyWriteRowRequest, + callback: Callback< + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, + {}|null|undefined>): void; + readModifyWriteRow( + request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.bigtable.v2.IReadModifyWriteRowResponse, + protos.google.bigtable.v2.IReadModifyWriteRowRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.readModifyWriteRow(request, options, callback); + } + +/** + * Streams back the contents of all requested rows in key order, optionally + * applying the same Reader filter to each. Depending on their size, + * rows and cells may be broken up across multiple responses, but + * atomicity of each row will still be preserved. See the + * ReadRowsResponse documentation for details. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table from which to read. + * Values are of the form + * `projects//instances//tables/
`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {google.bigtable.v2.RowSet} request.rows + * The row keys and/or ranges to read sequentially. If not specified, reads + * from all rows. + * @param {google.bigtable.v2.RowFilter} request.filter + * The filter to apply to the contents of the specified row(s). If unset, + * reads the entirety of each row. + * @param {number} request.rowsLimit + * The read will stop after committing to N rows' worth of results. The + * default (zero) is to return all 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 [ReadRowsResponse]{@link google.bigtable.v2.ReadRowsResponse} on 'data' event. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) + * for more details and examples. + */ + readRows( + request?: protos.google.bigtable.v2.IReadRowsRequest, + options?: CallOptions): + gax.CancellableStream{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.readRows(request, options); + } + +/** + * Returns a sample of row keys in the table. The returned row keys will + * delimit contiguous sections of the table of approximately equal size, + * which can be used to break up the data for distributed tasks like + * mapreduces. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table from which to sample row keys. + * Values are of the form + * `projects//instances//tables/
`. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @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 [SampleRowKeysResponse]{@link google.bigtable.v2.SampleRowKeysResponse} on 'data' event. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) + * for more details and examples. + */ + sampleRowKeys( + request?: protos.google.bigtable.v2.ISampleRowKeysRequest, + options?: CallOptions): + gax.CancellableStream{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.sampleRowKeys(request, options); + } + +/** + * Mutates multiple rows in a batch. Each individual row is mutated + * atomically as in MutateRow, but the entire batch is not executed + * atomically. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tableName + * Required. The unique name of the table to which the mutations should be applied. + * @param {string} request.appProfileId + * This value specifies routing for replication. If not specified, the + * "default" application profile will be used. + * @param {number[]} request.entries + * Required. The row keys and corresponding mutations to be applied in bulk. + * Each entry is applied as an atomic mutation, but the entries may be + * applied in arbitrary order (even between entries for the same row). + * At least one entry must be specified, and in total the entries can + * contain at most 100000 mutations. + * @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 [MutateRowsResponse]{@link google.bigtable.v2.MutateRowsResponse} on 'data' event. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) + * for more details and examples. + */ + mutateRows( + request?: protos.google.bigtable.v2.IMutateRowsRequest, + options?: CallOptions): + gax.CancellableStream{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; + if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ + Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} + + if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ + Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} + + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams( + routingParameter + ); + this.initialize(); + return this.innerApiCalls.mutateRows(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified table resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} table + * @returns {string} Resource name string. + */ + tablePath(project:string,instance:string,table:string) { + return this.pathTemplates.tablePathTemplate.render({ + project: project, + instance: instance, + table: table, + }); + } + + /** + * Parse the project from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).project; + } + + /** + * Parse the instance from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).instance; + } + + /** + * Parse the table from Table resource. + * + * @param {string} tableName + * A fully-qualified path representing Table resource. + * @returns {string} A string representing the table. + */ + matchTableFromTableName(tableName: string) { + return this.pathTemplates.tablePathTemplate.match(tableName).table; + } + + /** + * 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.bigtableStub && !this._terminated) { + return this.bigtableStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v2/src/v2/bigtable_client_config.json b/owl-bot-staging/v2/src/v2/bigtable_client_config.json new file mode 100644 index 000000000..9a86aabbc --- /dev/null +++ b/owl-bot-staging/v2/src/v2/bigtable_client_config.json @@ -0,0 +1,69 @@ +{ + "interfaces": { + "google.bigtable.v2.Bigtable": { + "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 + }, + "5af39a0f6db447f61c4f695240caeccb74f78362": { + "initial_retry_delay_millis": 10, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ReadRows": { + "timeout_millis": 43200000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SampleRowKeys": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "MutateRow": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "MutateRows": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CheckAndMutateRow": { + "timeout_millis": 20000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PingAndWarm": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReadModifyWriteRow": { + "timeout_millis": 20000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/bigtable_proto_list.json b/owl-bot-staging/v2/src/v2/bigtable_proto_list.json new file mode 100644 index 000000000..f3b34ab8b --- /dev/null +++ b/owl-bot-staging/v2/src/v2/bigtable_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/bigtable/v2/bigtable.proto", + "../../protos/google/bigtable/v2/data.proto" +] diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json new file mode 100644 index 000000000..cfaf1b67d --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,78 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.bigtable.v2", + "libraryPackage": "@google-cloud/bigtable", + "services": { + "Bigtable": { + "clients": { + "grpc": { + "libraryClient": "BigtableClient", + "rpcs": { + "MutateRow": { + "methods": [ + "mutateRow" + ] + }, + "CheckAndMutateRow": { + "methods": [ + "checkAndMutateRow" + ] + }, + "PingAndWarm": { + "methods": [ + "pingAndWarm" + ] + }, + "ReadModifyWriteRow": { + "methods": [ + "readModifyWriteRow" + ] + }, + "ReadRows": { + "methods": [ + "readRows" + ] + }, + "SampleRowKeys": { + "methods": [ + "sampleRowKeys" + ] + }, + "MutateRows": { + "methods": [ + "mutateRows" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BigtableClient", + "rpcs": { + "MutateRow": { + "methods": [ + "mutateRow" + ] + }, + "CheckAndMutateRow": { + "methods": [ + "checkAndMutateRow" + ] + }, + "PingAndWarm": { + "methods": [ + "pingAndWarm" + ] + }, + "ReadModifyWriteRow": { + "methods": [ + "readModifyWriteRow" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts new file mode 100644 index 000000000..6fea83b0c --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {BigtableClient} from './bigtable_client'; diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 000000000..693dcd77f --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const bigtable = require('@google-cloud/bigtable'); + +function main() { + const bigtableClient = new bigtable.BigtableClient(); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 000000000..de6e377da --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {BigtableClient} from '@google-cloud/bigtable'; + +// check that the client class type name can be used +function doStuffWithBigtableClient(client: BigtableClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const bigtableClient = new BigtableClient(); + doStuffWithBigtableClient(bigtableClient); +} + +main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts new file mode 100644 index 000000000..8ec452229 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v2/test/gapic_bigtable_v2.ts b/owl-bot-staging/v2/test/gapic_bigtable_v2.ts new file mode 100644 index 000000000..69a59d0f2 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_bigtable_v2.ts @@ -0,0 +1,866 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as bigtableModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubServerStreamingCall(response?: ResponseType, error?: Error) { + const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // write something to the stream to trigger transformStub and send the response back to the client + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + return sinon.stub().returns(mockStream); +} + +describe('v2.BigtableClient', () => { + it('has servicePath', () => { + const servicePath = bigtableModule.v2.BigtableClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = bigtableModule.v2.BigtableClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = bigtableModule.v2.BigtableClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new bigtableModule.v2.BigtableClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new bigtableModule.v2.BigtableClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableStub, undefined); + await client.initialize(); + assert(client.bigtableStub); + }); + + it('has close method for the initialized client', done => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.bigtableStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.bigtableStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new bigtableModule.v2.BigtableClient({ + 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 bigtableModule.v2.BigtableClient({ + 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('mutateRow', () => { + it('invokes mutateRow without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowResponse()); + client.innerApiCalls.mutateRow = stubSimpleCall(expectedResponse); + const [response] = await client.mutateRow(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.mutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes mutateRow without error using callback', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowResponse()); + client.innerApiCalls.mutateRow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.mutateRow( + request, + (err?: Error|null, result?: protos.google.bigtable.v2.IMutateRowResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.mutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes mutateRow with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.mutateRow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.mutateRow(request), expectedError); + assert((client.innerApiCalls.mutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes mutateRow with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.mutateRow(request), expectedError); + }); + }); + + describe('checkAndMutateRow', () => { + it('invokes checkAndMutateRow without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowResponse()); + client.innerApiCalls.checkAndMutateRow = stubSimpleCall(expectedResponse); + const [response] = await client.checkAndMutateRow(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkAndMutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkAndMutateRow without error using callback', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowResponse()); + client.innerApiCalls.checkAndMutateRow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.checkAndMutateRow( + request, + (err?: Error|null, result?: protos.google.bigtable.v2.ICheckAndMutateRowResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.checkAndMutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes checkAndMutateRow with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.checkAndMutateRow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAndMutateRow(request), expectedError); + assert((client.innerApiCalls.checkAndMutateRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkAndMutateRow with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.checkAndMutateRow(request), expectedError); + }); + }); + + describe('pingAndWarm', () => { + it('invokes pingAndWarm without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmResponse()); + client.innerApiCalls.pingAndWarm = stubSimpleCall(expectedResponse); + const [response] = await client.pingAndWarm(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pingAndWarm as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pingAndWarm without error using callback', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmResponse()); + client.innerApiCalls.pingAndWarm = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pingAndWarm( + request, + (err?: Error|null, result?: protos.google.bigtable.v2.IPingAndWarmResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pingAndWarm as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pingAndWarm with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.pingAndWarm = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pingAndWarm(request), expectedError); + assert((client.innerApiCalls.pingAndWarm as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pingAndWarm with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pingAndWarm(request), expectedError); + }); + }); + + describe('readModifyWriteRow', () => { + it('invokes readModifyWriteRow without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowResponse()); + client.innerApiCalls.readModifyWriteRow = stubSimpleCall(expectedResponse); + const [response] = await client.readModifyWriteRow(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.readModifyWriteRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes readModifyWriteRow without error using callback', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowResponse()); + client.innerApiCalls.readModifyWriteRow = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.readModifyWriteRow( + request, + (err?: Error|null, result?: protos.google.bigtable.v2.IReadModifyWriteRowResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.readModifyWriteRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes readModifyWriteRow with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.readModifyWriteRow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.readModifyWriteRow(request), expectedError); + assert((client.innerApiCalls.readModifyWriteRow as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes readModifyWriteRow with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.readModifyWriteRow(request), expectedError); + }); + }); + + describe('readRows', () => { + it('invokes readRows without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsResponse()); + client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); + const stream = client.readRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.readRows as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes readRows with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.readRows = stubServerStreamingCall(undefined, expectedError); + const stream = client.readRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.readRows as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes readRows with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + const stream = client.readRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + }); + + describe('sampleRowKeys', () => { + it('invokes sampleRowKeys without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysResponse()); + client.innerApiCalls.sampleRowKeys = stubServerStreamingCall(expectedResponse); + const stream = client.sampleRowKeys(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.sampleRowKeys as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes sampleRowKeys with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.sampleRowKeys = stubServerStreamingCall(undefined, expectedError); + const stream = client.sampleRowKeys(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.sampleRowKeys as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes sampleRowKeys with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + const stream = client.sampleRowKeys(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + }); + + describe('mutateRows', () => { + it('invokes mutateRows without error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsResponse()); + client.innerApiCalls.mutateRows = stubServerStreamingCall(expectedResponse); + const stream = client.mutateRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.mutateRows as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes mutateRows with error', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); + const expectedHeaderRequestParams = ""; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.mutateRows = stubServerStreamingCall(undefined, expectedError); + const stream = client.mutateRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.mutateRows as SinonStub) + .getCall(0).calledWith(request, expectedOptions)); + }); + + it('invokes mutateRows with closed client', async () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + const stream = client.mutateRows(request); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + }); + }); + + describe('Path templates', () => { + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + }; + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('table', () => { + const fakePath = "/rendered/path/table"; + const expectedParameters = { + project: "projectValue", + instance: "instanceValue", + table: "tableValue", + }; + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tablePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tablePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tablePath', () => { + const result = client.tablePath("projectValue", "instanceValue", "tableValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tablePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTableName', () => { + const result = client.matchProjectFromTableName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromTableName', () => { + const result = client.matchInstanceFromTableName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTableFromTableName', () => { + const result = client.matchTableFromTableName(fakePath); + assert.strictEqual(result, "tableValue"); + assert((client.pathTemplates.tablePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json new file mode 100644 index 000000000..c78f1c884 --- /dev/null +++ b/owl-bot-staging/v2/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js new file mode 100644 index 000000000..9b488aad8 --- /dev/null +++ b/owl-bot-staging/v2/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'bigtable', + filename: './bigtable.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 40b58a6b6b77badc6059358138f6e7b35791df6c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 23 Mar 2022 19:01:47 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/admin/v2/.eslintignore | 7 - owl-bot-staging/admin/v2/.eslintrc.json | 3 - owl-bot-staging/admin/v2/.gitignore | 14 - owl-bot-staging/admin/v2/.jsdoc.js | 55 - owl-bot-staging/admin/v2/.mocharc.js | 33 - owl-bot-staging/admin/v2/.prettierrc.js | 22 - owl-bot-staging/admin/v2/README.md | 1 - .../admin/v2/linkinator.config.json | 16 - owl-bot-staging/admin/v2/package.json | 65 - .../admin/v2/bigtable_instance_admin.proto | 698 ---- .../admin/v2/bigtable_table_admin.proto | 1003 ----- .../google/bigtable/admin/v2/common.proto | 55 - .../google/bigtable/admin/v2/instance.proto | 333 -- .../google/bigtable/admin/v2/table.proto | 405 -- ...table_instance_admin.create_app_profile.js | 77 - .../bigtable_instance_admin.create_cluster.js | 74 - ...bigtable_instance_admin.create_instance.js | 82 - ...table_instance_admin.delete_app_profile.js | 64 - .../bigtable_instance_admin.delete_cluster.js | 59 - ...bigtable_instance_admin.delete_instance.js | 59 - ...bigtable_instance_admin.get_app_profile.js | 59 - .../v2/bigtable_instance_admin.get_cluster.js | 59 - .../bigtable_instance_admin.get_iam_policy.js | 64 - .../bigtable_instance_admin.get_instance.js | 59 - ...gtable_instance_admin.list_app_profiles.js | 78 - .../bigtable_instance_admin.list_clusters.js | 65 - .../bigtable_instance_admin.list_instances.js | 63 - ...e_instance_admin.partial_update_cluster.js | 65 - ..._instance_admin.partial_update_instance.js | 65 - .../bigtable_instance_admin.set_iam_policy.js | 67 - ...ble_instance_admin.test_iam_permissions.js | 67 - ...table_instance_admin.update_app_profile.js | 69 - .../bigtable_instance_admin.update_cluster.js | 93 - ...bigtable_instance_admin.update_instance.js | 95 - .../bigtable_table_admin.check_consistency.js | 65 - .../v2/bigtable_table_admin.create_backup.js | 76 - .../v2/bigtable_table_admin.create_table.js | 88 - ..._table_admin.create_table_from_snapshot.js | 74 - .../v2/bigtable_table_admin.delete_backup.js | 60 - .../bigtable_table_admin.delete_snapshot.js | 60 - .../v2/bigtable_table_admin.delete_table.js | 60 - .../v2/bigtable_table_admin.drop_row_range.js | 69 - ..._table_admin.generate_consistency_token.js | 60 - .../v2/bigtable_table_admin.get_backup.js | 60 - .../v2/bigtable_table_admin.get_iam_policy.js | 64 - .../v2/bigtable_table_admin.get_snapshot.js | 60 - .../v2/bigtable_table_admin.get_table.js | 65 - .../v2/bigtable_table_admin.list_backups.js | 126 - .../v2/bigtable_table_admin.list_snapshots.js | 73 - .../v2/bigtable_table_admin.list_tables.js | 80 - ...able_table_admin.modify_column_families.js | 68 - .../v2/bigtable_table_admin.restore_table.js | 74 - .../v2/bigtable_table_admin.set_iam_policy.js | 67 - .../v2/bigtable_table_admin.snapshot_table.js | 87 - ...gtable_table_admin.test_iam_permissions.js | 67 - .../v2/bigtable_table_admin.update_backup.js | 70 - ...pet_metadata.google.bigtable.admin.v2.json | 1999 ---------- owl-bot-staging/admin/v2/src/index.ts | 27 - .../src/v2/bigtable_instance_admin_client.ts | 2869 --------------- ...bigtable_instance_admin_client_config.json | 140 - .../bigtable_instance_admin_proto_list.json | 7 - .../v2/src/v2/bigtable_table_admin_client.ts | 3142 ---------------- .../bigtable_table_admin_client_config.json | 143 - .../v2/bigtable_table_admin_proto_list.json | 7 - .../admin/v2/src/v2/gapic_metadata.json | 487 --- owl-bot-staging/admin/v2/src/v2/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../admin/v2/system-test/install.ts | 49 - .../test/gapic_bigtable_instance_admin_v2.ts | 3152 ---------------- .../v2/test/gapic_bigtable_table_admin_v2.ts | 3243 ----------------- owl-bot-staging/admin/v2/tsconfig.json | 19 - owl-bot-staging/admin/v2/webpack.config.js | 64 - owl-bot-staging/v2/.eslintignore | 7 - owl-bot-staging/v2/.eslintrc.json | 3 - owl-bot-staging/v2/.gitignore | 14 - owl-bot-staging/v2/.jsdoc.js | 55 - owl-bot-staging/v2/.mocharc.js | 33 - owl-bot-staging/v2/.prettierrc.js | 22 - owl-bot-staging/v2/README.md | 1 - owl-bot-staging/v2/linkinator.config.json | 16 - owl-bot-staging/v2/package.json | 64 - .../protos/google/bigtable/v2/bigtable.proto | 528 --- .../v2/protos/google/bigtable/v2/data.proto | 535 --- .../v2/bigtable.check_and_mutate_row.js | 98 - .../generated/v2/bigtable.mutate_row.js | 81 - .../generated/v2/bigtable.mutate_rows.js | 78 - .../generated/v2/bigtable.ping_and_warm.js | 68 - .../v2/bigtable.read_modify_write_row.js | 82 - .../generated/v2/bigtable.read_rows.js | 86 - .../generated/v2/bigtable.sample_row_keys.js | 71 - .../snippet_metadata.google.bigtable.v2.json | 371 -- owl-bot-staging/v2/src/index.ts | 25 - owl-bot-staging/v2/src/v2/bigtable_client.ts | 925 ----- .../v2/src/v2/bigtable_client_config.json | 69 - .../v2/src/v2/bigtable_proto_list.json | 4 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 78 - owl-bot-staging/v2/src/v2/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v2/system-test/install.ts | 49 - owl-bot-staging/v2/test/gapic_bigtable_v2.ts | 866 ----- owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 - .../admin/v2/bigtable_instance_admin.proto | 64 +- .../google/bigtable/admin/v2/instance.proto | 42 +- protos/protos.d.ts | 357 ++ protos/protos.js | 1266 ++++++- protos/protos.json | 107 + ...igtable_instance_admin.list_hot_tablets.js | 0 ...pet_metadata.google.bigtable.admin.v2.json | 56 + src/v2/bigtable_instance_admin_client.ts | 327 ++ ...bigtable_instance_admin_client_config.json | 5 + src/v2/bigtable_table_admin_client.ts | 74 + src/v2/gapic_metadata.json | 14 + test/gapic_bigtable_instance_admin_v2.ts | 365 ++ test/gapic_bigtable_table_admin_v2.ts | 76 + 117 files changed, 2558 insertions(+), 25685 deletions(-) delete mode 100644 owl-bot-staging/admin/v2/.eslintignore delete mode 100644 owl-bot-staging/admin/v2/.eslintrc.json delete mode 100644 owl-bot-staging/admin/v2/.gitignore delete mode 100644 owl-bot-staging/admin/v2/.jsdoc.js delete mode 100644 owl-bot-staging/admin/v2/.mocharc.js delete mode 100644 owl-bot-staging/admin/v2/.prettierrc.js delete mode 100644 owl-bot-staging/admin/v2/README.md delete mode 100644 owl-bot-staging/admin/v2/linkinator.config.json delete mode 100644 owl-bot-staging/admin/v2/package.json delete mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto delete mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto delete mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto delete mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto delete mode 100644 owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js delete mode 100644 owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json delete mode 100644 owl-bot-staging/admin/v2/src/index.ts delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json delete mode 100644 owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json delete mode 100644 owl-bot-staging/admin/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/admin/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/admin/v2/system-test/install.ts delete mode 100644 owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts delete mode 100644 owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts delete mode 100644 owl-bot-staging/admin/v2/tsconfig.json delete mode 100644 owl-bot-staging/admin/v2/webpack.config.js delete mode 100644 owl-bot-staging/v2/.eslintignore delete mode 100644 owl-bot-staging/v2/.eslintrc.json delete mode 100644 owl-bot-staging/v2/.gitignore delete mode 100644 owl-bot-staging/v2/.jsdoc.js delete mode 100644 owl-bot-staging/v2/.mocharc.js delete mode 100644 owl-bot-staging/v2/.prettierrc.js delete mode 100644 owl-bot-staging/v2/README.md delete mode 100644 owl-bot-staging/v2/linkinator.config.json delete mode 100644 owl-bot-staging/v2/package.json delete mode 100644 owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto delete mode 100644 owl-bot-staging/v2/protos/google/bigtable/v2/data.proto delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js delete mode 100644 owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json delete mode 100644 owl-bot-staging/v2/src/index.ts delete mode 100644 owl-bot-staging/v2/src/v2/bigtable_client.ts delete mode 100644 owl-bot-staging/v2/src/v2/bigtable_client_config.json delete mode 100644 owl-bot-staging/v2/src/v2/bigtable_proto_list.json delete mode 100644 owl-bot-staging/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v2/system-test/install.ts delete mode 100644 owl-bot-staging/v2/test/gapic_bigtable_v2.ts delete mode 100644 owl-bot-staging/v2/tsconfig.json delete mode 100644 owl-bot-staging/v2/webpack.config.js rename {owl-bot-staging/admin/v2/samples => samples}/generated/v2/bigtable_instance_admin.list_hot_tablets.js (100%) diff --git a/owl-bot-staging/admin/v2/.eslintignore b/owl-bot-staging/admin/v2/.eslintignore deleted file mode 100644 index cfc348ec4..000000000 --- a/owl-bot-staging/admin/v2/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/admin/v2/.eslintrc.json b/owl-bot-staging/admin/v2/.eslintrc.json deleted file mode 100644 index 782153495..000000000 --- a/owl-bot-staging/admin/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/admin/v2/.gitignore b/owl-bot-staging/admin/v2/.gitignore deleted file mode 100644 index 5d32b2378..000000000 --- a/owl-bot-staging/admin/v2/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/admin/v2/.jsdoc.js b/owl-bot-staging/admin/v2/.jsdoc.js deleted file mode 100644 index 7cb0f52a2..000000000 --- a/owl-bot-staging/admin/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/bigtable', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/admin/v2/.mocharc.js b/owl-bot-staging/admin/v2/.mocharc.js deleted file mode 100644 index 481c522b0..000000000 --- a/owl-bot-staging/admin/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/admin/v2/.prettierrc.js b/owl-bot-staging/admin/v2/.prettierrc.js deleted file mode 100644 index 494e14786..000000000 --- a/owl-bot-staging/admin/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/admin/v2/README.md b/owl-bot-staging/admin/v2/README.md deleted file mode 100644 index 5d45b74ed..000000000 --- a/owl-bot-staging/admin/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Admin: Nodejs Client diff --git a/owl-bot-staging/admin/v2/linkinator.config.json b/owl-bot-staging/admin/v2/linkinator.config.json deleted file mode 100644 index befd23c86..000000000 --- a/owl-bot-staging/admin/v2/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/admin/v2/package.json b/owl-bot-staging/admin/v2/package.json deleted file mode 100644 index 6da83a9f9..000000000 --- a/owl-bot-staging/admin/v2/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/bigtable", - "version": "0.1.0", - "description": "Admin client for Node.js", - "repository": "googleapis/nodejs-admin", - "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 admin", - "admin", - "bigtable instance admin", - "bigtable table admin" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto deleted file mode 100644 index 6dfc0e2a9..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ /dev/null @@ -1,698 +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.bigtable.admin.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/bigtable/admin/v2/instance.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; -option java_multiple_files = true; -option java_outer_classname = "BigtableInstanceAdminProto"; -option java_package = "com.google.bigtable.admin.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; -option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; - -// Service for creating, configuring, and deleting Cloud Bigtable Instances and -// Clusters. Provides access to the Instance and Cluster schemas only, not the -// tables' metadata or data stored in those tables. -service BigtableInstanceAdmin { - option (google.api.default_host) = "bigtableadmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigtable.admin," - "https://www.googleapis.com/auth/bigtable.admin.cluster," - "https://www.googleapis.com/auth/bigtable.admin.instance," - "https://www.googleapis.com/auth/cloud-bigtable.admin," - "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Create an instance within a project. - // - // Note that exactly one of Cluster.serve_nodes and - // Cluster.cluster_config.cluster_autoscaling_config can be set. If - // serve_nodes is set to non-zero, then the cluster is manually scaled. If - // cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - // enabled. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/instances" - body: "*" - }; - option (google.api.method_signature) = "parent,instance_id,instance,clusters"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "CreateInstanceMetadata" - }; - } - - // Gets information about an instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists information about instances in a project. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an instance within a project. This method updates only the display - // name and type for an Instance. To update other Instance properties, such as - // labels, use PartialUpdateInstance. - rpc UpdateInstance(Instance) returns (Instance) { - option (google.api.http) = { - put: "/v2/{name=projects/*/instances/*}" - body: "*" - }; - } - - // Partially updates an instance within a project. This method can modify all - // fields of an Instance and is the preferred way to update an Instance. - rpc PartialUpdateInstance(PartialUpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{instance.name=projects/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "instance,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "UpdateInstanceMetadata" - }; - } - - // Delete an instance from a project. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a cluster within an instance. - // - // Note that exactly one of Cluster.serve_nodes and - // Cluster.cluster_config.cluster_autoscaling_config can be set. If - // serve_nodes is set to non-zero, then the cluster is manually scaled. If - // cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - // enabled. - rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*}/clusters" - body: "cluster" - }; - option (google.api.method_signature) = "parent,cluster_id,cluster"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "CreateClusterMetadata" - }; - } - - // Gets information about a cluster. - rpc GetCluster(GetClusterRequest) returns (Cluster) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*/clusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists information about clusters in an instance. - rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*}/clusters" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a cluster within an instance. - // - // Note that UpdateCluster does not support updating - // cluster_config.cluster_autoscaling_config. In order to update it, you - // must use PartialUpdateCluster. - rpc UpdateCluster(Cluster) returns (google.longrunning.Operation) { - option (google.api.http) = { - put: "/v2/{name=projects/*/instances/*/clusters/*}" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "UpdateClusterMetadata" - }; - } - - // Partially updates a cluster within a project. This method is the preferred - // way to update a Cluster. - // - // To enable and update autoscaling, set - // cluster_config.cluster_autoscaling_config. When autoscaling is enabled, - // serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it - // are ignored. Note that an update cannot simultaneously set serve_nodes to - // non-zero and cluster_config.cluster_autoscaling_config to non-empty, and - // also specify both in the update_mask. - // - // To disable autoscaling, clear cluster_config.cluster_autoscaling_config, - // and explicitly set a serve_node count via the update_mask. - rpc PartialUpdateCluster(PartialUpdateClusterRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{cluster.name=projects/*/instances/*/clusters/*}" - body: "cluster" - }; - option (google.api.method_signature) = "cluster,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Cluster" - metadata_type: "PartialUpdateClusterMetadata" - }; - } - - // Deletes a cluster from an instance. - rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*/clusters/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an app profile within an instance. - rpc CreateAppProfile(CreateAppProfileRequest) returns (AppProfile) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*}/appProfiles" - body: "app_profile" - }; - option (google.api.method_signature) = "parent,app_profile_id,app_profile"; - } - - // Gets information about an app profile. - rpc GetAppProfile(GetAppProfileRequest) returns (AppProfile) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*/appProfiles/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists information about app profiles in an instance. - rpc ListAppProfiles(ListAppProfilesRequest) returns (ListAppProfilesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*}/appProfiles" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an app profile within an instance. - rpc UpdateAppProfile(UpdateAppProfileRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}" - body: "app_profile" - }; - option (google.api.method_signature) = "app_profile,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "AppProfile" - metadata_type: "UpdateAppProfileMetadata" - }; - } - - // Deletes an app profile from an instance. - rpc DeleteAppProfile(DeleteAppProfileRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*/appProfiles/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy for an instance resource. Returns an empty - // policy if an instance exists but does not have a policy set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Sets the access control policy on an instance resource. Replaces any - // existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns permissions that the caller has on the specified instance resource. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Lists hot tablets in a cluster, within the time range provided. Hot - // tablets are ordered based on CPU usage. - rpc ListHotTablets(ListHotTabletsRequest) returns (ListHotTabletsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for BigtableInstanceAdmin.CreateInstance. -message CreateInstanceRequest { - // Required. The unique name of the project in which to create the new instance. - // Values are of the form `projects/{project}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The ID to be used when referring to the new instance within its project, - // e.g., just `myinstance` rather than - // `projects/myproject/instances/myinstance`. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The instance to create. - // Fields marked `OutputOnly` must be left blank. - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The clusters to be created within the instance, mapped by desired - // cluster ID, e.g., just `mycluster` rather than - // `projects/myproject/instances/myinstance/clusters/mycluster`. - // Fields marked `OutputOnly` must be left blank. - // Currently, at most four clusters can be specified. - map clusters = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for BigtableInstanceAdmin.GetInstance. -message GetInstanceRequest { - // Required. The unique name of the requested instance. Values are of the form - // `projects/{project}/instances/{instance}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; -} - -// Request message for BigtableInstanceAdmin.ListInstances. -message ListInstancesRequest { - // Required. The unique name of the project for which a list of instances is requested. - // Values are of the form `projects/{project}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // DEPRECATED: This field is unused and ignored. - string page_token = 2; -} - -// Response message for BigtableInstanceAdmin.ListInstances. -message ListInstancesResponse { - // The list of requested instances. - repeated Instance instances = 1; - - // Locations from which Instance information could not be retrieved, - // due to an outage or some other transient condition. - // Instances whose Clusters are all in one of the failed locations - // may be missing from `instances`, and Instances with at least one - // Cluster in a failed location may only have partial information returned. - // Values are of the form `projects//locations/` - repeated string failed_locations = 2; - - // DEPRECATED: This field is unused and ignored. - string next_page_token = 3; -} - -// Request message for BigtableInstanceAdmin.PartialUpdateInstance. -message PartialUpdateInstanceRequest { - // Required. The Instance which will (partially) replace the current value. - Instance instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The subset of Instance fields which should be replaced. - // Must be explicitly set. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for BigtableInstanceAdmin.DeleteInstance. -message DeleteInstanceRequest { - // Required. The unique name of the instance to be deleted. - // Values are of the form `projects/{project}/instances/{instance}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; -} - -// Request message for BigtableInstanceAdmin.CreateCluster. -message CreateClusterRequest { - // Required. The unique name of the instance in which to create the new cluster. - // Values are of the form - // `projects/{project}/instances/{instance}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Required. The ID to be used when referring to the new cluster within its instance, - // e.g., just `mycluster` rather than - // `projects/myproject/instances/myinstance/clusters/mycluster`. - string cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The cluster to be created. - // Fields marked `OutputOnly` must be left blank. - Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for BigtableInstanceAdmin.GetCluster. -message GetClusterRequest { - // Required. The unique name of the requested cluster. Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; -} - -// Request message for BigtableInstanceAdmin.ListClusters. -message ListClustersRequest { - // Required. The unique name of the instance for which a list of clusters is requested. - // Values are of the form `projects/{project}/instances/{instance}`. - // Use `{instance} = '-'` to list Clusters for all Instances in a project, - // e.g., `projects/myproject/instances/-`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // DEPRECATED: This field is unused and ignored. - string page_token = 2; -} - -// Response message for BigtableInstanceAdmin.ListClusters. -message ListClustersResponse { - // The list of requested clusters. - repeated Cluster clusters = 1; - - // Locations from which Cluster information could not be retrieved, - // due to an outage or some other transient condition. - // Clusters from these locations may be missing from `clusters`, - // or may only have partial information returned. - // Values are of the form `projects//locations/` - repeated string failed_locations = 2; - - // DEPRECATED: This field is unused and ignored. - string next_page_token = 3; -} - -// Request message for BigtableInstanceAdmin.DeleteCluster. -message DeleteClusterRequest { - // Required. The unique name of the cluster to be deleted. Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; -} - -// The metadata for the Operation returned by CreateInstance. -message CreateInstanceMetadata { - // The request that prompted the initiation of this CreateInstance operation. - CreateInstanceRequest original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The metadata for the Operation returned by UpdateInstance. -message UpdateInstanceMetadata { - // The request that prompted the initiation of this UpdateInstance operation. - PartialUpdateInstanceRequest original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The metadata for the Operation returned by CreateCluster. -message CreateClusterMetadata { - // The request that prompted the initiation of this CreateCluster operation. - CreateClusterRequest original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The metadata for the Operation returned by UpdateCluster. -message UpdateClusterMetadata { - // The request that prompted the initiation of this UpdateCluster operation. - Cluster original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The metadata for the Operation returned by PartialUpdateCluster. -message PartialUpdateClusterMetadata { - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 1; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 2; - - // The original request for PartialUpdateCluster. - PartialUpdateClusterRequest original_request = 3; -} - -// Request message for BigtableInstanceAdmin.PartialUpdateCluster. -message PartialUpdateClusterRequest { - // Required. The Cluster which contains the partial updates to be applied, subject to - // the update_mask. - Cluster cluster = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The subset of Cluster fields which should be replaced. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for BigtableInstanceAdmin.CreateAppProfile. -message CreateAppProfileRequest { - // Required. The unique name of the instance in which to create the new app profile. - // Values are of the form - // `projects/{project}/instances/{instance}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Required. The ID to be used when referring to the new app profile within its - // instance, e.g., just `myprofile` rather than - // `projects/myproject/instances/myinstance/appProfiles/myprofile`. - string app_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The app profile to be created. - // Fields marked `OutputOnly` will be ignored. - AppProfile app_profile = 3 [(google.api.field_behavior) = REQUIRED]; - - // If true, ignore safety checks when creating the app profile. - bool ignore_warnings = 4; -} - -// Request message for BigtableInstanceAdmin.GetAppProfile. -message GetAppProfileRequest { - // Required. The unique name of the requested app profile. Values are of the form - // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/AppProfile" - } - ]; -} - -// Request message for BigtableInstanceAdmin.ListAppProfiles. -message ListAppProfilesRequest { - // Required. The unique name of the instance for which a list of app profiles is - // requested. Values are of the form - // `projects/{project}/instances/{instance}`. - // Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - // e.g., `projects/myproject/instances/-`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Maximum number of results per page. - // - // A page_size of zero lets the server choose the number of items to return. - // A page_size which is strictly positive will return at most that many items. - // A negative page_size will cause an error. - // - // Following the first request, subsequent paginated calls are not required - // to pass a page_size. If a page_size is set in subsequent calls, it must - // match the page_size given in the first request. - int32 page_size = 3; - - // The value of `next_page_token` returned by a previous call. - string page_token = 2; -} - -// Response message for BigtableInstanceAdmin.ListAppProfiles. -message ListAppProfilesResponse { - // The list of requested app profiles. - repeated AppProfile app_profiles = 1; - - // Set if not all app profiles could be returned in a single response. - // Pass this value to `page_token` in another request to get the next - // page of results. - string next_page_token = 2; - - // Locations from which AppProfile information could not be retrieved, - // due to an outage or some other transient condition. - // AppProfiles from these locations may be missing from `app_profiles`. - // Values are of the form `projects//locations/` - repeated string failed_locations = 3; -} - -// Request message for BigtableInstanceAdmin.UpdateAppProfile. -message UpdateAppProfileRequest { - // Required. The app profile which will (partially) replace the current value. - AppProfile app_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The subset of app profile fields which should be replaced. - // If unset, all fields will be replaced. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // If true, ignore safety checks when updating the app profile. - bool ignore_warnings = 3; -} - -// Request message for BigtableInstanceAdmin.DeleteAppProfile. -message DeleteAppProfileRequest { - // Required. The unique name of the app profile to be deleted. Values are of the form - // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/AppProfile" - } - ]; - - // Required. If true, ignore safety checks when deleting the app profile. - bool ignore_warnings = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The metadata for the Operation returned by UpdateAppProfile. -message UpdateAppProfileMetadata { - -} - -// Request message for BigtableInstanceAdmin.ListHotTablets. -message ListHotTabletsRequest { - // Required. The cluster name to list hot tablets. - // Value is in the following form: - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; - - // The start time to list hot tablets. The hot tablets in the response will - // have start times between the requested start time and end time. Start time - // defaults to Now if it is unset, and end time defaults to Now - 24 hours if - // it is unset. The start time should be less than the end time, and the - // maximum allowed time range between start time and end time is 48 hours. - // Start time and end time should have values between Now and Now - 14 days. - google.protobuf.Timestamp start_time = 2; - - // The end time to list hot tablets. - google.protobuf.Timestamp end_time = 3; - - // Maximum number of results per page. - // - // A page_size that is empty or zero lets the server choose the number of - // items to return. A page_size which is strictly positive will return at most - // that many items. A negative page_size will cause an error. - // - // Following the first request, subsequent paginated calls do not need a - // page_size field. If a page_size is set in subsequent calls, it must match - // the page_size given in the first request. - int32 page_size = 4; - - // The value of `next_page_token` returned by a previous call. - string page_token = 5; -} - -// Response message for BigtableInstanceAdmin.ListHotTablets. -message ListHotTabletsResponse { - // List of hot tablets in the tables of the requested cluster that fall - // within the requested time range. Hot tablets are ordered by node cpu usage - // percent. If there are multiple hot tablets that correspond to the same - // tablet within a 15-minute interval, only the hot tablet with the highest - // node cpu usage will be included in the response. - repeated HotTablet hot_tablets = 1; - - // Set if not all hot tablets could be returned in a single response. - // Pass this value to `page_token` in another request to get the next - // page of results. - string next_page_token = 2; -} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto deleted file mode 100644 index 88bd87047..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_table_admin.proto +++ /dev/null @@ -1,1003 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.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.bigtable.admin.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/bigtable/admin/v2/common.proto"; -import "google/bigtable/admin/v2/table.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; -option java_multiple_files = true; -option java_outer_classname = "BigtableTableAdminProto"; -option java_package = "com.google.bigtable.admin.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; -option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; - -// Service for creating, configuring, and deleting Cloud Bigtable tables. -// -// -// Provides access to the table schemas only, not the data stored within -// the tables. -service BigtableTableAdmin { - option (google.api.default_host) = "bigtableadmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigtable.admin," - "https://www.googleapis.com/auth/bigtable.admin.table," - "https://www.googleapis.com/auth/cloud-bigtable.admin," - "https://www.googleapis.com/auth/cloud-bigtable.admin.table," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Creates a new table in the specified instance. - // The table can be created with a full set of initial column families, - // specified in the request. - rpc CreateTable(CreateTableRequest) returns (Table) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*}/tables" - body: "*" - }; - option (google.api.method_signature) = "parent,table_id,table"; - } - - // Creates a new table from the specified snapshot. The target table must - // not exist. The snapshot and the table must be in the same instance. - // - // Note: This is a private alpha release of Cloud Bigtable snapshots. This - // feature is not currently available to most Cloud Bigtable customers. This - // feature might be changed in backward-incompatible ways and is not - // recommended for production use. It is not subject to any SLA or deprecation - // policy. - rpc CreateTableFromSnapshot(CreateTableFromSnapshotRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot" - body: "*" - }; - option (google.api.method_signature) = "parent,table_id,source_snapshot"; - option (google.longrunning.operation_info) = { - response_type: "Table" - metadata_type: "CreateTableFromSnapshotMetadata" - }; - } - - // Lists all tables served from a specified instance. - rpc ListTables(ListTablesRequest) returns (ListTablesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*}/tables" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets metadata information about the specified table. - rpc GetTable(GetTableRequest) returns (Table) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*/tables/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Permanently deletes a specified table and all of its data. - rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*/tables/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Performs a series of column family modifications on the specified table. - // Either all or none of the modifications will occur before this method - // returns, but data requests received prior to that point may see a table - // where only some modifications have taken effect. - rpc ModifyColumnFamilies(ModifyColumnFamiliesRequest) returns (Table) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies" - body: "*" - }; - option (google.api.method_signature) = "name,modifications"; - } - - // Permanently drop/delete a row range from a specified table. The request can - // specify whether to delete all rows in a table, or only those that match a - // particular prefix. - rpc DropRowRange(DropRowRangeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*/tables/*}:dropRowRange" - body: "*" - }; - } - - // Generates a consistency token for a Table, which can be used in - // CheckConsistency to check whether mutations to the table that finished - // before this call started have been replicated. The tokens will be available - // for 90 days. - rpc GenerateConsistencyToken(GenerateConsistencyTokenRequest) returns (GenerateConsistencyTokenResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Checks replication consistency based on a consistency token, that is, if - // replication has caught up based on the conditions specified in the token - // and the check request. - rpc CheckConsistency(CheckConsistencyRequest) returns (CheckConsistencyResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*/tables/*}:checkConsistency" - body: "*" - }; - option (google.api.method_signature) = "name,consistency_token"; - } - - // Creates a new snapshot in the specified cluster from the specified - // source table. The cluster and the table must be in the same instance. - // - // Note: This is a private alpha release of Cloud Bigtable snapshots. This - // feature is not currently available to most Cloud Bigtable customers. This - // feature might be changed in backward-incompatible ways and is not - // recommended for production use. It is not subject to any SLA or deprecation - // policy. - rpc SnapshotTable(SnapshotTableRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*/tables/*}:snapshot" - body: "*" - }; - option (google.api.method_signature) = "name,cluster,snapshot_id,description"; - option (google.longrunning.operation_info) = { - response_type: "Snapshot" - metadata_type: "SnapshotTableMetadata" - }; - } - - // Gets metadata information about the specified snapshot. - // - // Note: This is a private alpha release of Cloud Bigtable snapshots. This - // feature is not currently available to most Cloud Bigtable customers. This - // feature might be changed in backward-incompatible ways and is not - // recommended for production use. It is not subject to any SLA or deprecation - // policy. - rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all snapshots associated with the specified cluster. - // - // Note: This is a private alpha release of Cloud Bigtable snapshots. This - // feature is not currently available to most Cloud Bigtable customers. This - // feature might be changed in backward-incompatible ways and is not - // recommended for production use. It is not subject to any SLA or deprecation - // policy. - rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*/clusters/*}/snapshots" - }; - option (google.api.method_signature) = "parent"; - } - - // Permanently deletes the specified snapshot. - // - // Note: This is a private alpha release of Cloud Bigtable snapshots. This - // feature is not currently available to most Cloud Bigtable customers. This - // feature might be changed in backward-incompatible ways and is not - // recommended for production use. It is not subject to any SLA or deprecation - // policy. - rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Starts creating a new Cloud Bigtable Backup. The returned backup - // [long-running operation][google.longrunning.Operation] can be used to - // track creation of the backup. The - // [metadata][google.longrunning.Operation.metadata] field type is - // [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The - // [response][google.longrunning.Operation.response] field type is - // [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the - // creation and delete the backup. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*/clusters/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup_id,backup"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "CreateBackupMetadata" - }; - } - - // Gets metadata on a pending or completed Cloud Bigtable Backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a pending or completed Cloud Bigtable Backup. - rpc UpdateBackup(UpdateBackupRequest) returns (Backup) { - option (google.api.http) = { - patch: "/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup,update_mask"; - } - - // Deletes a pending or completed Cloud Bigtable backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Cloud Bigtable backups. Returns both completed and pending - // backups. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/instances/*/clusters/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Create a new table by restoring from a completed backup. The new table - // must be in the same project as the instance containing the backup. The - // returned table [long-running operation][google.longrunning.Operation] can - // be used to track the progress of the operation, and to cancel it. The - // [metadata][google.longrunning.Operation.metadata] field type is - // [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The - // [response][google.longrunning.Operation.response] type is - // [Table][google.bigtable.admin.v2.Table], if successful. - rpc RestoreTable(RestoreTableRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/instances/*}/tables:restore" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Table" - metadata_type: "RestoreTableMetadata" - }; - } - - // Gets the access control policy for a Table or Backup resource. - // Returns an empty policy if the resource exists but does not have a policy - // set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy" - body: "*" - additional_bindings { - post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:getIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource"; - } - - // Sets the access control policy on a Table or Backup resource. - // Replaces any existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy" - body: "*" - additional_bindings { - post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:setIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns permissions that the caller has on the specified Table or Backup resource. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:testIamPermissions" - body: "*" - } - }; - option (google.api.method_signature) = "resource,permissions"; - } -} - -// The request for -// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable]. -message RestoreTableRequest { - // Required. The name of the instance in which to create the restored - // table. This instance must be in the same project as the source backup. - // Values are of the form `projects//instances/`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Required. The id of the table to create and restore to. This - // table must not already exist. The `table_id` appended to - // `parent` forms the full table name of the form - // `projects//instances//tables/`. - string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The source from which to restore. - oneof source { - // Name of the backup from which to restore. Values are of the form - // `projects//instances//clusters//backups/`. - string backup = 3 [(google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Backup" - }]; - } -} - -// Metadata type for the long-running operation returned by -// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable]. -message RestoreTableMetadata { - // Name of the table being created and restored to. - string name = 1; - - // The type of the restore source. - RestoreSourceType source_type = 2; - - // Information about the source used to restore the table, as specified by - // `source` in [RestoreTableRequest][google.bigtable.admin.v2.RestoreTableRequest]. - oneof source_info { - BackupInfo backup_info = 3; - } - - // If exists, the name of the long-running operation that will be used to - // track the post-restore optimization process to optimize the performance of - // the restored table. The metadata type of the long-running operation is - // [OptimizeRestoreTableMetadata][]. The response type is - // [Empty][google.protobuf.Empty]. This long-running operation may be - // automatically created by the system if applicable after the - // RestoreTable long-running operation completes successfully. This operation - // may not be created if the table is already optimized or the restore was - // not successful. - string optimize_table_operation_name = 4; - - // The progress of the [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable] - // operation. - OperationProgress progress = 5; -} - -// Metadata type for the long-running operation used to track the progress -// of optimizations performed on a newly restored table. This long-running -// operation is automatically created by the system after the successful -// completion of a table restore, and cannot be cancelled. -message OptimizeRestoredTableMetadata { - // Name of the restored table being optimized. - string name = 1; - - // The progress of the post-restore optimizations. - OperationProgress progress = 2; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable] -message CreateTableRequest { - // An initial split point for a newly created table. - message Split { - // Row key to use as an initial tablet boundary. - bytes key = 1; - } - - // Required. The unique name of the instance in which to create the table. - // Values are of the form `projects/{project}/instances/{instance}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Required. The name by which the new table should be referred to within the parent - // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - // Maximum 50 characters. - string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Table to create. - Table table = 3 [(google.api.field_behavior) = REQUIRED]; - - // The optional list of row keys that will be used to initially split the - // table into several tablets (tablets are similar to HBase regions). - // Given two split keys, `s1` and `s2`, three tablets will be created, - // spanning the key ranges: `[, s1), [s1, s2), [s2, )`. - // - // Example: - // - // * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` - // `"other", "zz"]` - // * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` - // * Key assignment: - // - Tablet 1 `[, apple) => {"a"}.` - // - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` - // - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` - // - Tablet 4 `[customer_2, other) => {"customer_2"}.` - // - Tablet 5 `[other, ) => {"other", "zz"}.` - repeated Split initial_splits = 4; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message CreateTableFromSnapshotRequest { - // Required. The unique name of the instance in which to create the table. - // Values are of the form `projects/{project}/instances/{instance}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // Required. The name by which the new table should be referred to within the parent - // instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The unique name of the snapshot from which to restore the table. The - // snapshot and the table must be in the same instance. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - string source_snapshot = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Snapshot" - } - ]; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange] -message DropRowRangeRequest { - // Required. The unique name of the table on which to drop a range of rows. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // Delete all rows or by prefix. - oneof target { - // Delete all rows that start with this row key prefix. Prefix cannot be - // zero length. - bytes row_key_prefix = 2; - - // Delete all rows in the table. Setting this to false is a no-op. - bool delete_all_data_from_table = 3; - } -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] -message ListTablesRequest { - // Required. The unique name of the instance for which tables should be listed. - // Values are of the form `projects/{project}/instances/{instance}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // The view to be applied to the returned tables' fields. - // Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - Table.View view = 2; - - // Maximum number of results per page. - // - // A page_size of zero lets the server choose the number of items to return. - // A page_size which is strictly positive will return at most that many items. - // A negative page_size will cause an error. - // - // Following the first request, subsequent paginated calls are not required - // to pass a page_size. If a page_size is set in subsequent calls, it must - // match the page_size given in the first request. - int32 page_size = 4; - - // The value of `next_page_token` returned by a previous call. - string page_token = 3; -} - -// Response message for -// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] -message ListTablesResponse { - // The tables present in the requested instance. - repeated Table tables = 1; - - // Set if not all tables could be returned in a single response. - // Pass this value to `page_token` in another request to get the next - // page of results. - string next_page_token = 2; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable] -message GetTableRequest { - // Required. The unique name of the requested table. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // The view to be applied to the returned table's fields. - // Defaults to `SCHEMA_VIEW` if unspecified. - Table.View view = 2; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable] -message DeleteTableRequest { - // Required. The unique name of the table to be deleted. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies] -message ModifyColumnFamiliesRequest { - // A create, update, or delete of a particular column family. - message Modification { - // The ID of the column family to be modified. - string id = 1; - - // Column familiy modifications. - oneof mod { - // Create a new column family with the specified schema, or fail if - // one already exists with the given ID. - ColumnFamily create = 2; - - // Update an existing column family to the specified schema, or fail - // if no column family exists with the given ID. - ColumnFamily update = 3; - - // Drop (delete) the column family with the given ID, or fail if no such - // family exists. - bool drop = 4; - } - } - - // Required. The unique name of the table whose families should be modified. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // Required. Modifications to be atomically applied to the specified table's families. - // Entries are applied in order, meaning that earlier modifications can be - // masked by later ones (in the case of repeated updates to the same family, - // for example). - repeated Modification modifications = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken] -message GenerateConsistencyTokenRequest { - // Required. The unique name of the Table for which to create a consistency token. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; -} - -// Response message for -// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken] -message GenerateConsistencyTokenResponse { - // The generated consistency token. - string consistency_token = 1; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency] -message CheckConsistencyRequest { - // Required. The unique name of the Table for which to check replication consistency. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // Required. The token created using GenerateConsistencyToken for the Table. - string consistency_token = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for -// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency] -message CheckConsistencyResponse { - // True only if the token is consistent. A token is consistent if replication - // has caught up with the restrictions specified in the request. - bool consistent = 1; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message SnapshotTableRequest { - // Required. The unique name of the table to have the snapshot taken. - // Values are of the form - // `projects/{project}/instances/{instance}/tables/{table}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // Required. The name of the cluster where the snapshot will be created in. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - string cluster = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; - - // Required. The ID by which the new snapshot should be referred to within the parent - // cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` - // rather than - // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - string snapshot_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // The amount of time that the new snapshot can stay active after it is - // created. Once 'ttl' expires, the snapshot will get deleted. The maximum - // amount of time a snapshot can stay active is 7 days. If 'ttl' is not - // specified, the default value of 24 hours will be used. - google.protobuf.Duration ttl = 4; - - // Description of the snapshot. - string description = 5; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message GetSnapshotRequest { - // Required. The unique name of the requested snapshot. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Snapshot" - } - ]; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message ListSnapshotsRequest { - // Required. The unique name of the cluster for which snapshots should be listed. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - // Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - // e.g., `projects/{project}/instances/{instance}/clusters/-`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; - - // The maximum number of snapshots to return per page. - // CURRENTLY UNIMPLEMENTED AND IGNORED. - int32 page_size = 2; - - // The value of `next_page_token` returned by a previous call. - string page_token = 3; -} - -// Response message for -// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message ListSnapshotsResponse { - // The snapshots present in the requested cluster. - repeated Snapshot snapshots = 1; - - // Set if not all snapshots could be returned in a single response. - // Pass this value to `page_token` in another request to get the next - // page of results. - string next_page_token = 2; -} - -// Request message for -// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot] -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message DeleteSnapshotRequest { - // Required. The unique name of the snapshot to be deleted. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Snapshot" - } - ]; -} - -// The metadata for the Operation returned by SnapshotTable. -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message SnapshotTableMetadata { - // The request that prompted the initiation of this SnapshotTable operation. - SnapshotTableRequest original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The metadata for the Operation returned by CreateTableFromSnapshot. -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message CreateTableFromSnapshotMetadata { - // The request that prompted the initiation of this CreateTableFromSnapshot - // operation. - CreateTableFromSnapshotRequest original_request = 1; - - // The time at which the original request was received. - google.protobuf.Timestamp request_time = 2; - - // The time at which the operation failed or was completed successfully. - google.protobuf.Timestamp finish_time = 3; -} - -// The request for [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. -message CreateBackupRequest { - // Required. This must be one of the clusters in the instance in which this - // table is located. The backup will be stored in this cluster. Values are - // of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; - - // Required. The id of the backup to be created. The `backup_id` along with - // the parent `parent` are combined as {parent}/backups/{backup_id} to create - // the full backup name, of the form: - // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. - // This string must be between 1 and 50 characters in length and match the - // regex [_a-zA-Z0-9][-_.a-zA-Z0-9]*. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata type for the operation returned by -// [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]. -message CreateBackupMetadata { - // The name of the backup being created. - string name = 1; - - // The name of the table the backup is created from. - string source_table = 2; - - // The time at which this operation started. - google.protobuf.Timestamp start_time = 3; - - // If set, the time at which this operation finished or was cancelled. - google.protobuf.Timestamp end_time = 4; -} - -// The request for [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup]. -message UpdateBackupRequest { - // Required. The backup to update. `backup.name`, and the fields to be updated - // as specified by `update_mask` are required. Other fields are ignored. - // Update is only supported for the following fields: - // * `backup.expire_time`. - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A mask specifying which fields (e.g. `expire_time`) in the - // Backup resource should be updated. This mask is relative to the Backup - // resource, not to the request message. The field mask must always be - // specified; this prevents any future fields from being erased accidentally - // by clients that do not know about them. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request for [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup]. -message GetBackupRequest { - // Required. Name of the backup. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Backup" - } - ]; -} - -// The request for [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup]. -message DeleteBackupRequest { - // Required. Name of the backup to delete. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Backup" - } - ]; -} - -// The request for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. -message ListBackupsRequest { - // Required. The cluster to list backups from. Values are of the - // form `projects/{project}/instances/{instance}/clusters/{cluster}`. - // Use `{cluster} = '-'` to list backups for all clusters in an instance, - // e.g., `projects/{project}/instances/{instance}/clusters/-`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Cluster" - } - ]; - - // A filter expression that filters backups listed in the response. - // The expression must specify the field name, a comparison operator, - // and the value that you want to use for filtering. The value must be a - // string, a number, or a boolean. The comparison operator must be - // <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - // roughly synonymous with equality. Filter rules are case insensitive. - // - // The fields eligible for filtering are: - // * `name` - // * `source_table` - // * `state` - // * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - // * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - // * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - // * `size_bytes` - // - // To filter on multiple expressions, provide each separate expression within - // parentheses. By default, each expression is an AND expression. However, - // you can include AND, OR, and NOT expressions explicitly. - // - // Some examples of using filters are: - // - // * `name:"exact"` --> The backup's name is the string "exact". - // * `name:howl` --> The backup's name contains the string "howl". - // * `source_table:prod` - // --> The source_table's name contains the string "prod". - // * `state:CREATING` --> The backup is pending creation. - // * `state:READY` --> The backup is fully created and ready for use. - // * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - // --> The backup name contains the string "howl" and start_time - // of the backup is before 2018-03-28T14:50:00Z. - // * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - string filter = 2; - - // An expression for specifying the sort order of the results of the request. - // The string value should specify one or more fields in [Backup][google.bigtable.admin.v2.Backup]. The full - // syntax is described at https://aip.dev/132#ordering. - // - // Fields supported are: - // * name - // * source_table - // * expire_time - // * start_time - // * end_time - // * size_bytes - // * state - // - // For example, "start_time". The default sorting order is ascending. - // To specify descending order for the field, a suffix " desc" should - // be appended to the field name. For example, "start_time desc". - // Redundant space characters in the syntax are insigificant. - // - // If order_by is empty, results will be sorted by `start_time` in descending - // order starting from the most recently created backup. - string order_by = 3; - - // Number of backups to be returned in the response. If 0 or - // less, defaults to the server's maximum allowed page size. - int32 page_size = 4; - - // If non-empty, `page_token` should contain a - // [next_page_token][google.bigtable.admin.v2.ListBackupsResponse.next_page_token] from a - // previous [ListBackupsResponse][google.bigtable.admin.v2.ListBackupsResponse] to the same `parent` and with the same - // `filter`. - string page_token = 5; -} - -// The response for [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]. -message ListBackupsResponse { - // The list of matching backups. - repeated Backup backups = 1; - - // `next_page_token` can be sent in a subsequent - // [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups] call to fetch more - // of the matching backups. - string next_page_token = 2; -} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto deleted file mode 100644 index 1d7782e67..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.bigtable.admin.v2; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.bigtable.admin.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; -option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; - -// Storage media types for persisting Bigtable data. -enum StorageType { - // The user did not specify a storage type. - STORAGE_TYPE_UNSPECIFIED = 0; - - // Flash (SSD) storage should be used. - SSD = 1; - - // Magnetic drive (HDD) storage should be used. - HDD = 2; -} - -// Encapsulates progress related information for a Cloud Bigtable long -// running operation. -message OperationProgress { - // Percent completion of the operation. - // Values are between 0 and 100 inclusive. - int32 progress_percent = 1; - - // Time the request was received. - google.protobuf.Timestamp start_time = 2; - - // If set, the time at which this operation failed or was completed - // successfully. - google.protobuf.Timestamp end_time = 3; -} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto deleted file mode 100644 index c15b91411..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto +++ /dev/null @@ -1,333 +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.bigtable.admin.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/bigtable/admin/v2/common.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; -option java_multiple_files = true; -option java_outer_classname = "InstanceProto"; -option java_package = "com.google.bigtable.admin.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; -option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; - -// A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and -// the resources that serve them. -// All tables in an instance are served from all -// [Clusters][google.bigtable.admin.v2.Cluster] in the instance. -message Instance { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/Instance" - pattern: "projects/{project}/instances/{instance}" - }; - - // Possible states of an instance. - enum State { - // The state of the instance could not be determined. - STATE_NOT_KNOWN = 0; - - // The instance has been successfully created and can serve requests - // to its tables. - READY = 1; - - // The instance is currently being created, and may be destroyed - // if the creation process encounters an error. - CREATING = 2; - } - - // The type of the instance. - enum Type { - // The type of the instance is unspecified. If set when creating an - // instance, a `PRODUCTION` instance will be created. If set when updating - // an instance, the type will be left unchanged. - TYPE_UNSPECIFIED = 0; - - // An instance meant for production use. `serve_nodes` must be set - // on the cluster. - PRODUCTION = 1; - - // The instance is meant for development and testing purposes only; it has - // no performance or uptime guarantees and is not covered by SLA. - // After a development instance is created, it can be upgraded by - // updating the instance to type `PRODUCTION`. An instance created - // as a production instance cannot be changed to a development instance. - // When creating a development instance, `serve_nodes` on the cluster must - // not be set. - DEVELOPMENT = 2; - } - - // The unique name of the instance. Values are of the form - // `projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The descriptive name for this instance as it appears in UIs. - // Can be changed at any time, but should be kept globally unique - // to avoid confusion. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // (`OutputOnly`) - // The current state of the instance. - State state = 3; - - // The type of the instance. Defaults to `PRODUCTION`. - Type type = 4; - - // Labels are a flexible and lightweight mechanism for organizing cloud - // resources into groups that reflect a customer's organizational needs and - // deployment strategies. They can be used to filter resources and aggregate - // metrics. - // - // * Label keys must be between 1 and 63 characters long and must conform to - // the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. - // * Label values must be between 0 and 63 characters long and must conform to - // the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. - // * No more than 64 labels can be associated with a given resource. - // * Keys and values must both be under 128 bytes. - map labels = 5; - - // Output only. A server-assigned timestamp representing when this Instance was created. - // For instances created before this field was added (August 2021), this value - // is `seconds: 0, nanos: 1`. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The Autoscaling targets for a Cluster. These determine the recommended nodes. -message AutoscalingTargets { - // The cpu utilization that the Autoscaler should be trying to achieve. - // This number is on a scale from 0 (no utilization) to - // 100 (total utilization). - int32 cpu_utilization_percent = 2; -} - -// Limits for the number of nodes a Cluster can autoscale up/down to. -message AutoscalingLimits { - // Required. Minimum number of nodes to scale down to. - int32 min_serve_nodes = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Maximum number of nodes to scale up to. - int32 max_serve_nodes = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A resizable group of nodes in a particular cloud location, capable -// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent -// [Instance][google.bigtable.admin.v2.Instance]. -message Cluster { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/Cluster" - pattern: "projects/{project}/instances/{instance}/clusters/{cluster}" - }; - - // Autoscaling config for a cluster. - message ClusterAutoscalingConfig { - // Required. Autoscaling limits for this cluster. - AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Autoscaling targets for this cluster. - AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Configuration for a cluster. - message ClusterConfig { - // Autoscaling configuration for this cluster. - ClusterAutoscalingConfig cluster_autoscaling_config = 1; - } - - // Cloud Key Management Service (Cloud KMS) settings for a CMEK-protected - // cluster. - message EncryptionConfig { - // Describes the Cloud KMS encryption key that will be used to protect the - // destination Bigtable cluster. The requirements for this key are: - // 1) The Cloud Bigtable service account associated with the project that - // contains this cluster must be granted the - // `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key. - // 2) Only regional keys can be used and the region of the CMEK key must - // match the region of the cluster. - // 3) All clusters within an instance must use the same CMEK key. - string kms_key_name = 1 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; - } - - // Possible states of a cluster. - enum State { - // The state of the cluster could not be determined. - STATE_NOT_KNOWN = 0; - - // The cluster has been successfully created and is ready to serve requests. - READY = 1; - - // The cluster is currently being created, and may be destroyed - // if the creation process encounters an error. - // A cluster may not be able to serve requests while being created. - CREATING = 2; - - // The cluster is currently being resized, and may revert to its previous - // node count if the process encounters an error. - // A cluster is still capable of serving requests while being resized, - // but may exhibit performance as if its number of allocated nodes is - // between the starting and requested states. - RESIZING = 3; - - // The cluster has no backing nodes. The data (tables) still - // exist, but no operations can be performed on the cluster. - DISABLED = 4; - } - - // The unique name of the cluster. Values are of the form - // `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // (`CreationOnly`) - // The location where this cluster's nodes and storage reside. For best - // performance, clients should be located as close as possible to this - // cluster. Currently only zones are supported, so values should be of the - // form `projects/{project}/locations/{zone}`. - string location = 2 [(google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - }]; - - // The current state of the cluster. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The number of nodes allocated to this cluster. More nodes enable higher - // throughput and more consistent performance. - int32 serve_nodes = 4; - - oneof config { - // Configuration for this cluster. - ClusterConfig cluster_config = 7; - } - - // (`CreationOnly`) - // The type of storage used by this cluster to serve its - // parent instance's tables, unless explicitly overridden. - StorageType default_storage_type = 5; - - // Immutable. The encryption configuration for CMEK-protected clusters. - EncryptionConfig encryption_config = 6 - [(google.api.field_behavior) = IMMUTABLE]; -} - -// A configuration object describing how Cloud Bigtable should treat traffic -// from a particular end user application. -message AppProfile { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/AppProfile" - pattern: "projects/{project}/instances/{instance}/appProfiles/{app_profile}" - }; - - // Read/write requests are routed to the nearest cluster in the instance, and - // will fail over to the nearest cluster that is available in the event of - // transient errors or delays. Clusters in a region are considered - // equidistant. Choosing this option sacrifices read-your-writes consistency - // to improve availability. - message MultiClusterRoutingUseAny { - // The set of clusters to route to. The order is ignored; clusters will be - // tried in order of distance. If left empty, all clusters are eligible. - repeated string cluster_ids = 1; - } - - // Unconditionally routes all read/write requests to a specific cluster. - // This option preserves read-your-writes consistency but does not improve - // availability. - message SingleClusterRouting { - // The cluster to which read/write requests should be routed. - string cluster_id = 1; - - // Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are - // allowed by this app profile. It is unsafe to send these requests to - // the same table/row/column in multiple clusters. - bool allow_transactional_writes = 2; - } - - // (`OutputOnly`) - // The unique name of the app profile. Values are of the form - // `projects/{project}/instances/{instance}/appProfiles/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. - string name = 1; - - // Strongly validated etag for optimistic concurrency control. Preserve the - // value returned from `GetAppProfile` when calling `UpdateAppProfile` to - // fail the request if there has been a modification in the mean time. The - // `update_mask` of the request need not include `etag` for this protection - // to apply. - // See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and - // [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more - // details. - string etag = 2; - - // Optional long form description of the use case for this AppProfile. - string description = 3; - - // The routing policy for all read/write requests that use this app profile. - // A value must be explicitly set. - oneof routing_policy { - // Use a multi-cluster routing policy. - MultiClusterRoutingUseAny multi_cluster_routing_use_any = 5; - - // Use a single-cluster routing policy. - SingleClusterRouting single_cluster_routing = 6; - } -} - -// A tablet is a defined by a start and end key and is explained in -// https://cloud.google.com/bigtable/docs/overview#architecture and -// https://cloud.google.com/bigtable/docs/performance#optimization. -// A Hot tablet is a tablet that exhibits high average cpu usage during the time -// interval from start time to end time. -message HotTablet { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/HotTablet" - pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" - }; - - // The unique name of the hot tablet. Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*`. - string name = 1; - - // Name of the table that contains the tablet. Values are of the form - // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. - string table_name = 2 [(google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - }]; - - // Output only. The start time of the hot tablet. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The end time of the hot tablet. - google.protobuf.Timestamp end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Tablet Start Key (inclusive). - string start_key = 5; - - // Tablet End Key (inclusive). - string end_key = 6; - - // Output only. The average CPU usage spent by a node on this tablet over the start_time to - // end_time time range. The percentage is the amount of CPU used by the node - // to serve the tablet, from 0% (tablet was not interacted with) to 100% (the - // node spent all cycles serving the hot tablet). - float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto deleted file mode 100644 index 4e2d709ab..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/table.proto +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.bigtable.admin.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin"; -option java_multiple_files = true; -option java_outer_classname = "TableProto"; -option java_package = "com.google.bigtable.admin.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2"; -option ruby_package = "Google::Cloud::Bigtable::Admin::V2"; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" -}; - -// Indicates the type of the restore source. -enum RestoreSourceType { - // No restore associated. - RESTORE_SOURCE_TYPE_UNSPECIFIED = 0; - - // A backup was used as the source of the restore. - BACKUP = 1; -} - -// Information about a table restore. -message RestoreInfo { - // The type of the restore source. - RestoreSourceType source_type = 1; - - // Information about the source used to restore the table. - oneof source_info { - // Information about the backup used to restore the table. The backup - // may no longer exist. - BackupInfo backup_info = 2; - } -} - -// A collection of user data indexed by row, column, and timestamp. -// Each table is served using the resources of its parent cluster. -message Table { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/Table" - pattern: "projects/{project}/instances/{instance}/tables/{table}" - }; - - // The state of a table's data in a particular cluster. - message ClusterState { - // Table replication states. - enum ReplicationState { - // The replication state of the table is unknown in this cluster. - STATE_NOT_KNOWN = 0; - - // The cluster was recently created, and the table must finish copying - // over pre-existing data from other clusters before it can begin - // receiving live replication updates and serving Data API requests. - INITIALIZING = 1; - - // The table is temporarily unable to serve Data API requests from this - // cluster due to planned internal maintenance. - PLANNED_MAINTENANCE = 2; - - // The table is temporarily unable to serve Data API requests from this - // cluster due to unplanned or emergency maintenance. - UNPLANNED_MAINTENANCE = 3; - - // The table can serve Data API requests from this cluster. Depending on - // replication delay, reads may not immediately reflect the state of the - // table in other clusters. - READY = 4; - - // The table is fully created and ready for use after a restore, and is - // being optimized for performance. When optimizations are complete, the - // table will transition to `READY` state. - READY_OPTIMIZING = 5; - } - - // Output only. The state of replication for the table in this cluster. - ReplicationState replication_state = 1; - - // Output only. The encryption information for the table in this cluster. - // If the encryption key protecting this resource is customer managed, then - // its version can be rotated in Cloud Key Management Service (Cloud KMS). - // The primary version of the key and its status will be reflected here when - // changes propagate from Cloud KMS. - repeated EncryptionInfo encryption_info = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Possible timestamp granularities to use when keeping multiple versions - // of data in a table. - enum TimestampGranularity { - // The user did not specify a granularity. Should not be returned. - // When specified during table creation, MILLIS will be used. - TIMESTAMP_GRANULARITY_UNSPECIFIED = 0; - - // The table keeps data versioned at a granularity of 1ms. - MILLIS = 1; - } - - // Defines a view over a table's fields. - enum View { - // Uses the default view for each method as documented in its request. - VIEW_UNSPECIFIED = 0; - - // Only populates `name`. - NAME_ONLY = 1; - - // Only populates `name` and fields related to the table's schema. - SCHEMA_VIEW = 2; - - // Only populates `name` and fields related to the table's replication - // state. - REPLICATION_VIEW = 3; - - // Only populates 'name' and fields related to the table's encryption state. - ENCRYPTION_VIEW = 5; - - // Populates all fields. - FULL = 4; - } - - // The unique name of the table. Values are of the form - // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. - // Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL` - string name = 1; - - // Output only. Map from cluster ID to per-cluster table state. - // If it could not be determined whether or not the table has data in a - // particular cluster (for example, if its zone is unavailable), then - // there will be an entry for the cluster with UNKNOWN `replication_status`. - // Views: `REPLICATION_VIEW`, `ENCRYPTION_VIEW`, `FULL` - map cluster_states = 2; - - // (`CreationOnly`) - // The column families configured for this table, mapped by column family ID. - // Views: `SCHEMA_VIEW`, `FULL` - map column_families = 3; - - // (`CreationOnly`) - // The granularity (i.e. `MILLIS`) at which timestamps are stored in - // this table. Timestamps not matching the granularity will be rejected. - // If unspecified at creation time, the value will be set to `MILLIS`. - // Views: `SCHEMA_VIEW`, `FULL`. - TimestampGranularity granularity = 4; - - // Output only. If this table was restored from another data source (e.g. a - // backup), this field will be populated with information about the restore. - RestoreInfo restore_info = 6; -} - -// A set of columns within a table which share a common configuration. -message ColumnFamily { - // Garbage collection rule specified as a protobuf. - // Must serialize to at most 500 bytes. - // - // NOTE: Garbage collection executes opportunistically in the background, and - // so it's possible for reads to return a cell even if it matches the active - // GC expression for its family. - GcRule gc_rule = 1; -} - -// Rule for determining which cells to delete during garbage collection. -message GcRule { - // A GcRule which deletes cells matching all of the given rules. - message Intersection { - // Only delete cells which would be deleted by every element of `rules`. - repeated GcRule rules = 1; - } - - // A GcRule which deletes cells matching any of the given rules. - message Union { - // Delete cells which would be deleted by any element of `rules`. - repeated GcRule rules = 1; - } - - // Garbage collection rules. - oneof rule { - // Delete all cells in a column except the most recent N. - int32 max_num_versions = 1; - - // Delete cells in a column older than the given age. - // Values must be at least one millisecond, and will be truncated to - // microsecond granularity. - google.protobuf.Duration max_age = 2; - - // Delete cells that would be deleted by every nested rule. - Intersection intersection = 3; - - // Delete cells that would be deleted by any nested rule. - Union union = 4; - } -} - -// Encryption information for a given resource. -// If this resource is protected with customer managed encryption, the in-use -// Cloud Key Management Service (Cloud KMS) key version is specified along with -// its status. -message EncryptionInfo { - // Possible encryption types for a resource. - enum EncryptionType { - // Encryption type was not specified, though data at rest remains encrypted. - ENCRYPTION_TYPE_UNSPECIFIED = 0; - - // The data backing this resource is encrypted at rest with a key that is - // fully managed by Google. No key version or status will be populated. - // This is the default state. - GOOGLE_DEFAULT_ENCRYPTION = 1; - - // The data backing this resource is encrypted at rest with a key that is - // managed by the customer. - // The in-use version of the key and its status are populated for - // CMEK-protected tables. - // CMEK-protected backups are pinned to the key version that was in use at - // the time the backup was taken. This key version is populated but its - // status is not tracked and is reported as `UNKNOWN`. - CUSTOMER_MANAGED_ENCRYPTION = 2; - } - - // Output only. The type of encryption used to protect this resource. - EncryptionType encryption_type = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of encrypt/decrypt calls on underlying data for - // this resource. Regardless of status, the existing data is always encrypted - // at rest. - google.rpc.Status encryption_status = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The version of the Cloud KMS key specified in the parent - // cluster that is in use for the data underlying this table. - string kms_key_version = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKeyVersion" - } - ]; -} - -// A snapshot of a table at a particular time. A snapshot can be used as a -// checkpoint for data restoration or a data source for a new table. -// -// Note: This is a private alpha release of Cloud Bigtable snapshots. This -// feature is not currently available to most Cloud Bigtable customers. This -// feature might be changed in backward-incompatible ways and is not recommended -// for production use. It is not subject to any SLA or deprecation policy. -message Snapshot { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/Snapshot" - pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}" - }; - - // Possible states of a snapshot. - enum State { - // The state of the snapshot could not be determined. - STATE_NOT_KNOWN = 0; - - // The snapshot has been successfully created and can serve all requests. - READY = 1; - - // The snapshot is currently being created, and may be destroyed if the - // creation process encounters an error. A snapshot may not be restored to a - // table while it is being created. - CREATING = 2; - } - - // Output only. The unique name of the snapshot. - // Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - string name = 1; - - // Output only. The source table at the time the snapshot was taken. - Table source_table = 2; - - // Output only. The size of the data in the source table at the time the - // snapshot was taken. In some cases, this value may be computed - // asynchronously via a background process and a placeholder of 0 will be used - // in the meantime. - int64 data_size_bytes = 3; - - // Output only. The time when the snapshot is created. - google.protobuf.Timestamp create_time = 4; - - // Output only. The time when the snapshot will be deleted. The maximum amount - // of time a snapshot can stay active is 365 days. If 'ttl' is not specified, - // the default maximum of 365 days will be used. - google.protobuf.Timestamp delete_time = 5; - - // Output only. The current state of the snapshot. - State state = 6; - - // Output only. Description of the snapshot. - string description = 7; -} - -// A backup of a Cloud Bigtable table. -message Backup { - option (google.api.resource) = { - type: "bigtableadmin.googleapis.com/Backup" - pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}" - }; - - // Indicates the current state of the backup. - enum State { - // Not specified. - STATE_UNSPECIFIED = 0; - - // The pending backup is still being created. Operations on the - // backup may fail with `FAILED_PRECONDITION` in this state. - CREATING = 1; - - // The backup is complete and ready for use. - READY = 2; - } - - // Output only. A globally unique identifier for the backup which cannot be - // changed. Values are of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}/ - // backups/[_a-zA-Z0-9][-_.a-zA-Z0-9]*` - // The final segment of the name must be between 1 and 50 characters - // in length. - // - // The backup is stored in the cluster identified by the prefix of the backup - // name of the form - // `projects/{project}/instances/{instance}/clusters/{cluster}`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. Name of the table from which this backup was created. - // This needs to be in the same instance as the backup. Values are of the form - // `projects/{project}/instances/{instance}/tables/{source_table}`. - string source_table = 2 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED - ]; - - // Required. The expiration time of the backup, with microseconds - // granularity that must be at least 6 hours and at most 30 days - // from the time the request is received. Once the `expire_time` - // has passed, Cloud Bigtable will delete the backup and free the - // resources used by the backup. - google.protobuf.Timestamp expire_time = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Output only. `start_time` is the time that the backup was started - // (i.e. approximately the time the - // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup] - // request is received). The row data in this backup will be no older than - // this timestamp. - google.protobuf.Timestamp start_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `end_time` is the time that the backup was finished. The row - // data in the backup will be no newer than this timestamp. - google.protobuf.Timestamp end_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Size of the backup in bytes. - int64 size_bytes = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The encryption information for the backup. - EncryptionInfo encryption_info = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about a backup. -message BackupInfo { - // Output only. Name of the backup. - string backup = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time that the backup was started. Row data in the backup - // will be no older than this timestamp. - google.protobuf.Timestamp start_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This time that the backup was finished. Row data in the - // backup will be no newer than this timestamp. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the table the backup was created from. - string source_table = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js deleted file mode 100644 index a18c932bd..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, appProfileId, appProfile) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance in which to create the new app profile. - * Values are of the form - * `projects/{project}/instances/{instance}`. - */ - // const parent = 'abc123' - /** - * Required. The ID to be used when referring to the new app profile within its - * instance, e.g., just `myprofile` rather than - * `projects/myproject/instances/myinstance/appProfiles/myprofile`. - */ - // const appProfileId = 'abc123' - /** - * Required. The app profile to be created. - * Fields marked `OutputOnly` will be ignored. - */ - // const appProfile = {} - /** - * If true, ignore safety checks when creating the app profile. - */ - // const ignoreWarnings = true - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callCreateAppProfile() { - // Construct request - const request = { - parent, - appProfileId, - appProfile, - }; - - // Run request - const response = await adminClient.createAppProfile(request); - console.log(response); - } - - callCreateAppProfile(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js deleted file mode 100644 index 14aba24d0..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, clusterId, cluster) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance in which to create the new cluster. - * Values are of the form - * `projects/{project}/instances/{instance}`. - */ - // const parent = 'abc123' - /** - * Required. The ID to be used when referring to the new cluster within its instance, - * e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - */ - // const clusterId = 'abc123' - /** - * Required. The cluster to be created. - * Fields marked `OutputOnly` must be left blank. - */ - // const cluster = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callCreateCluster() { - // Construct request - const request = { - parent, - clusterId, - cluster, - }; - - // Run request - const [operation] = await adminClient.createCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateCluster(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js deleted file mode 100644 index 80125b099..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, instanceId, instance, clusters) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the project in which to create the new instance. - * Values are of the form `projects/{project}`. - */ - // const parent = 'abc123' - /** - * Required. The ID to be used when referring to the new instance within its project, - * e.g., just `myinstance` rather than - * `projects/myproject/instances/myinstance`. - */ - // const instanceId = 'abc123' - /** - * Required. The instance to create. - * Fields marked `OutputOnly` must be left blank. - */ - // const instance = {} - /** - * Required. The clusters to be created within the instance, mapped by desired - * cluster ID, e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - * Fields marked `OutputOnly` must be left blank. - * Currently, at most four clusters can be specified. - */ - // const clusters = 1234 - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - clusters, - }; - - // Run request - const [operation] = await adminClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js deleted file mode 100644 index 5074cabf1..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, ignoreWarnings) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the app profile to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - */ - // const name = 'abc123' - /** - * Required. If true, ignore safety checks when deleting the app profile. - */ - // const ignoreWarnings = true - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callDeleteAppProfile() { - // Construct request - const request = { - name, - ignoreWarnings, - }; - - // Run request - const response = await adminClient.deleteAppProfile(request); - console.log(response); - } - - callDeleteAppProfile(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js deleted file mode 100644 index e66fba3b3..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the cluster to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callDeleteCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteCluster(request); - console.log(response); - } - - callDeleteCluster(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js deleted file mode 100644 index 71cc7487f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance to be deleted. - * Values are of the form `projects/{project}/instances/{instance}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteInstance(request); - console.log(response); - } - - callDeleteInstance(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js deleted file mode 100644 index f5bb4df4b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the requested app profile. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callGetAppProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getAppProfile(request); - console.log(response); - } - - callGetAppProfile(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js deleted file mode 100644 index da86f66dc..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the requested cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callGetCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getCluster(request); - console.log(response); - } - - callGetCluster(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js deleted file mode 100644 index 337a3df8b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await adminClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js deleted file mode 100644 index 153ee1a90..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the requested instance. Values are of the form - * `projects/{project}/instances/{instance}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js deleted file mode 100644 index 34139bc14..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - */ - // const parent = 'abc123' - /** - * Maximum number of results per page. - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - */ - // const pageSize = 1234 - /** - * The value of `next_page_token` returned by a previous call. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callListAppProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listAppProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAppProfiles(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js deleted file mode 100644 index 2fd8ff90f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance for which a list of clusters is requested. - * Values are of the form `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list Clusters for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - */ - // const parent = 'abc123' - /** - * DEPRECATED: This field is unused and ignored. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callListClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await adminClient.listClusters(request); - console.log(response); - } - - callListClusters(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js deleted file mode 100644 index 69af4530a..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the project for which a list of instances is requested. - * Values are of the form `projects/{project}`. - */ - // const parent = 'abc123' - /** - * DEPRECATED: This field is unused and ignored. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await adminClient.listInstances(request); - console.log(response); - } - - callListInstances(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js deleted file mode 100644 index fe17f5f5c..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_cluster.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(cluster, updateMask) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Cluster which contains the partial updates to be applied, subject to - * the update_mask. - */ - // const cluster = {} - /** - * Required. The subset of Cluster fields which should be replaced. - */ - // const updateMask = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callPartialUpdateCluster() { - // Construct request - const request = { - cluster, - updateMask, - }; - - // Run request - const [operation] = await adminClient.partialUpdateCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPartialUpdateCluster(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js deleted file mode 100644 index bf58de3f3..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, updateMask) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Instance which will (partially) replace the current value. - */ - // const instance = {} - /** - * Required. The subset of Instance fields which should be replaced. - * Must be explicitly set. - */ - // const updateMask = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callPartialUpdateInstance() { - // Construct request - const request = { - instance, - updateMask, - }; - - // Run request - const [operation] = await adminClient.partialUpdateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPartialUpdateInstance(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js deleted file mode 100644 index 9c58200bf..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, policy) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await adminClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js deleted file mode 100644 index 2639051ac..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await adminClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js deleted file mode 100644 index 3f597b3da..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(appProfile, updateMask) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The app profile which will (partially) replace the current value. - */ - // const appProfile = {} - /** - * Required. The subset of app profile fields which should be replaced. - * If unset, all fields will be replaced. - */ - // const updateMask = {} - /** - * If true, ignore safety checks when updating the app profile. - */ - // const ignoreWarnings = true - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callUpdateAppProfile() { - // Construct request - const request = { - appProfile, - updateMask, - }; - - // Run request - const [operation] = await adminClient.updateAppProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateAppProfile(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js deleted file mode 100644 index 9a8ced3c2..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, state, encryptionConfig) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The unique name of the cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`. - */ - // const name = 'abc123' - /** - * (`CreationOnly`) - * The location where this cluster's nodes and storage reside. For best - * performance, clients should be located as close as possible to this - * cluster. Currently only zones are supported, so values should be of the - * form `projects/{project}/locations/{zone}`. - */ - // const location = 'abc123' - /** - * The current state of the cluster. - */ - // const state = {} - /** - * The number of nodes allocated to this cluster. More nodes enable higher - * throughput and more consistent performance. - */ - // const serveNodes = 1234 - /** - * Configuration for this cluster. - */ - // const clusterConfig = {} - /** - * (`CreationOnly`) - * The type of storage used by this cluster to serve its - * parent instance's tables, unless explicitly overridden. - */ - // const defaultStorageType = {} - /** - * Immutable. The encryption configuration for CMEK-protected clusters. - */ - // const encryptionConfig = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callUpdateCluster() { - // Construct request - const request = { - name, - state, - encryptionConfig, - }; - - // Run request - const [operation] = await adminClient.updateCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateCluster(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js deleted file mode 100644 index 83cc071a9..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, displayName, createTime) { - // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The unique name of the instance. Values are of the form - * `projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]`. - */ - // const name = 'abc123' - /** - * Required. The descriptive name for this instance as it appears in UIs. - * Can be changed at any time, but should be kept globally unique - * to avoid confusion. - */ - // const displayName = 'abc123' - /** - * (`OutputOnly`) - * The current state of the instance. - */ - // const state = {} - /** - * The type of the instance. Defaults to `PRODUCTION`. - */ - // const type = {} - /** - * Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. They can be used to filter resources and aggregate - * metrics. - * * Label keys must be between 1 and 63 characters long and must conform to - * the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform to - * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * * Keys and values must both be under 128 bytes. - */ - // const labels = 1234 - /** - * Output only. A server-assigned timestamp representing when this Instance was created. - * For instances created before this field was added (August 2021), this value - * is `seconds: 0, nanos: 1`. - */ - // const createTime = {} - - // Imports the Admin library - const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableInstanceAdminClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - name, - displayName, - createTime, - }; - - // Run request - const response = await adminClient.updateInstance(request); - console.log(response); - } - - callUpdateInstance(); - // [END bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js deleted file mode 100644 index 1de65f0dd..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, consistencyToken) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the Table for which to check replication consistency. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - /** - * Required. The token created using GenerateConsistencyToken for the Table. - */ - // const consistencyToken = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callCheckConsistency() { - // Construct request - const request = { - name, - consistencyToken, - }; - - // Run request - const response = await adminClient.checkConsistency(request); - console.log(response); - } - - callCheckConsistency(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js deleted file mode 100644 index eef56574f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backupId, backup) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. This must be one of the clusters in the instance in which this - * table is located. The backup will be stored in this cluster. Values are - * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - */ - // const parent = 'abc123' - /** - * Required. The id of the backup to be created. The `backup_id` along with - * the parent `parent` are combined as {parent}/backups/{backup_id} to create - * the full backup name, of the form: - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. - * This string must be between 1 and 50 characters in length and match the - * regex _a-zA-Z0-9 -_.a-zA-Z0-9 *. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. - */ - // const backup = {} - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await adminClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js deleted file mode 100644 index 38c853cc7..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, tableId, table) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - */ - // const parent = 'abc123' - /** - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - * Maximum 50 characters. - */ - // const tableId = 'abc123' - /** - * Required. The Table to create. - */ - // const table = {} - /** - * The optional list of row keys that will be used to initially split the - * table into several tablets (tablets are similar to HBase regions). - * Given two split keys, `s1` and `s2`, three tablets will be created, - * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. - * Example: - * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` - * `"other", "zz"` - * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` - * * Key assignment: - * - Tablet 1 `[, apple) => {"a"}.` - * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` - * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` - * - Tablet 4 `[customer_2, other) => {"customer_2"}.` - * - Tablet 5 `[other, ) => {"other", "zz"}.` - */ - // const initialSplits = 1234 - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callCreateTable() { - // Construct request - const request = { - parent, - tableId, - table, - }; - - // Run request - const response = await adminClient.createTable(request); - console.log(response); - } - - callCreateTable(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js deleted file mode 100644 index f64723b92..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, tableId, sourceSnapshot) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - */ - // const parent = 'abc123' - /** - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - */ - // const tableId = 'abc123' - /** - * Required. The unique name of the snapshot from which to restore the table. The - * snapshot and the table must be in the same instance. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - */ - // const sourceSnapshot = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callCreateTableFromSnapshot() { - // Construct request - const request = { - parent, - tableId, - sourceSnapshot, - }; - - // Run request - const [operation] = await adminClient.createTableFromSnapshot(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateTableFromSnapshot(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js deleted file mode 100644 index 6ff49c189..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the backup to delete. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteBackup(request); - console.log(response); - } - - callDeleteBackup(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js deleted file mode 100644 index 22a602e60..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the snapshot to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callDeleteSnapshot() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteSnapshot(request); - console.log(response); - } - - callDeleteSnapshot(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js deleted file mode 100644 index b5bd9bcc2..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callDeleteTable() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteTable(request); - console.log(response); - } - - callDeleteTable(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js deleted file mode 100644 index 2c7593bb1..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table on which to drop a range of rows. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - /** - * Delete all rows that start with this row key prefix. Prefix cannot be - * zero length. - */ - // const rowKeyPrefix = 'Buffer.from('string')' - /** - * Delete all rows in the table. Setting this to false is a no-op. - */ - // const deleteAllDataFromTable = true - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callDropRowRange() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.dropRowRange(request); - console.log(response); - } - - callDropRowRange(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js deleted file mode 100644 index a85007500..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the Table for which to create a consistency token. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callGenerateConsistencyToken() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.generateConsistencyToken(request); - console.log(response); - } - - callGenerateConsistencyToken(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js deleted file mode 100644 index 415d8bbfa..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the backup. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js deleted file mode 100644 index 568cd6ccc..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await adminClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js deleted file mode 100644 index 75eed032e..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the requested snapshot. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - */ - // const name = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callGetSnapshot() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getSnapshot(request); - console.log(response); - } - - callGetSnapshot(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js deleted file mode 100644 index 8a193836f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the requested table. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - /** - * The view to be applied to the returned table's fields. - * Defaults to `SCHEMA_VIEW` if unspecified. - */ - // const view = {} - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callGetTable() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getTable(request); - console.log(response); - } - - callGetTable(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js deleted file mode 100644 index 5645d9771..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - */ - // const parent = 'abc123' - /** - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * Some examples of using filters are: - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - */ - // const filter = 'abc123' - /** - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in Backup google.bigtable.admin.v2.Backup. The full - * syntax is described at https://aip.dev/132#ordering. - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - */ - // const orderBy = 'abc123' - /** - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - */ - // const pageSize = 1234 - /** - * If non-empty, `page_token` should contain a - * next_page_token google.bigtable.admin.v2.ListBackupsResponse.next_page_token from a - * previous ListBackupsResponse google.bigtable.admin.v2.ListBackupsResponse to the same `parent` and with the same - * `filter`. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js deleted file mode 100644 index e7dd971e8..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - */ - // const parent = 'abc123' - /** - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - */ - // const pageSize = 1234 - /** - * The value of `next_page_token` returned by a previous call. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callListSnapshots() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listSnapshotsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSnapshots(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js deleted file mode 100644 index 50cb12c84..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - */ - // const parent = 'abc123' - /** - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - */ - // const view = {} - /** - * Maximum number of results per page. - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - */ - // const pageSize = 1234 - /** - * The value of `next_page_token` returned by a previous call. - */ - // const pageToken = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callListTables() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listTablesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTables(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js deleted file mode 100644 index 55f0b9edb..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, modifications) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table whose families should be modified. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - /** - * Required. Modifications to be atomically applied to the specified table's families. - * Entries are applied in order, meaning that earlier modifications can be - * masked by later ones (in the case of repeated updates to the same family, - * for example). - */ - // const modifications = 1234 - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callModifyColumnFamilies() { - // Construct request - const request = { - name, - modifications, - }; - - // Run request - const response = await adminClient.modifyColumnFamilies(request); - console.log(response); - } - - callModifyColumnFamilies(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js deleted file mode 100644 index c2263f3d3..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, tableId) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the instance in which to create the restored - * table. This instance must be in the same project as the source backup. - * Values are of the form `projects//instances/`. - */ - // const parent = 'abc123' - /** - * Required. The id of the table to create and restore to. This - * table must not already exist. The `table_id` appended to - * `parent` forms the full table name of the form - * `projects//instances//tables/`. - */ - // const tableId = 'abc123' - /** - * Name of the backup from which to restore. Values are of the form - * `projects//instances//clusters//backups/`. - */ - // const backup = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callRestoreTable() { - // Construct request - const request = { - parent, - tableId, - }; - - // Run request - const [operation] = await adminClient.restoreTable(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreTable(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js deleted file mode 100644 index c95cda298..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, policy) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await adminClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js deleted file mode 100644 index 39e4efb21..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, cluster, snapshotId) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to have the snapshot taken. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - */ - // const name = 'abc123' - /** - * Required. The name of the cluster where the snapshot will be created in. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - */ - // const cluster = 'abc123' - /** - * Required. The ID by which the new snapshot should be referred to within the parent - * cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` - * rather than - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - */ - // const snapshotId = 'abc123' - /** - * The amount of time that the new snapshot can stay active after it is - * created. Once 'ttl' expires, the snapshot will get deleted. The maximum - * amount of time a snapshot can stay active is 7 days. If 'ttl' is not - * specified, the default value of 24 hours will be used. - */ - // const ttl = {} - /** - * Description of the snapshot. - */ - // const description = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callSnapshotTable() { - // Construct request - const request = { - name, - cluster, - snapshotId, - }; - - // Run request - const [operation] = await adminClient.snapshotTable(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSnapshotTable(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js deleted file mode 100644 index cdfbac097..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await adminClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js deleted file mode 100644 index 89a7b332c..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(backup, updateMask) { - // [START bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - */ - // const backup = {} - /** - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - */ - // const updateMask = {} - - // Imports the Admin library - const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const adminClient = new BigtableTableAdminClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - updateMask, - }; - - // Run request - const response = await adminClient.updateBackup(request); - console.log(response); - } - - callUpdateBackup(); - // [END bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json b/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json deleted file mode 100644 index 7036bf8d5..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json +++ /dev/null @@ -1,1999 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-admin", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.bigtable.admin.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async", - "title": "bigtable createInstance Sample", - "origin": "API_DEFINITION", - "description": " Create an instance within a project. Note that exactly one of Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is enabled.", - "canonical": true, - "file": "bigtable_instance_admin.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.bigtable.admin.v2.Instance" - }, - { - "name": "clusters", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateInstance", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async", - "title": "bigtable getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets information about an instance.", - "canonical": true, - "file": "bigtable_instance_admin.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.Instance", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async", - "title": "bigtable listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists information about instances in a project.", - "canonical": true, - "file": "bigtable_instance_admin.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListInstancesResponse", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async", - "title": "bigtable updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates an instance within a project. This method updates only the display name and type for an Instance. To update other Instance properties, such as labels, use PartialUpdateInstance.", - "canonical": true, - "file": "bigtable_instance_admin.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "display_name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.bigtable.admin.v2.Instance.State" - }, - { - "name": "type", - "type": ".google.bigtable.admin.v2.Instance.Type" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "create_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.bigtable.admin.v2.Instance", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateInstance", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async", - "title": "bigtable partialUpdateInstance Sample", - "origin": "API_DEFINITION", - "description": " Partially updates an instance within a project. This method can modify all fields of an Instance and is the preferred way to update an Instance.", - "canonical": true, - "file": "bigtable_instance_admin.partial_update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PartialUpdateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateInstance", - "async": true, - "parameters": [ - { - "name": "instance", - "type": ".google.bigtable.admin.v2.Instance" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "PartialUpdateInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateInstance", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async", - "title": "bigtable deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Delete an instance from a project.", - "canonical": true, - "file": "bigtable_instance_admin.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteInstance", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async", - "title": "bigtable createCluster Sample", - "origin": "API_DEFINITION", - "description": " Creates a cluster within an instance. Note that exactly one of Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is enabled.", - "canonical": true, - "file": "bigtable_instance_admin.create_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateCluster", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "cluster_id", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": ".google.bigtable.admin.v2.Cluster" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "CreateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateCluster", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async", - "title": "bigtable getCluster Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a cluster.", - "canonical": true, - "file": "bigtable_instance_admin.get_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.Cluster", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "GetCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async", - "title": "bigtable listClusters Sample", - "origin": "API_DEFINITION", - "description": " Lists information about clusters in an instance.", - "canonical": true, - "file": "bigtable_instance_admin.list_clusters.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListClusters", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListClustersResponse", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "ListClusters", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async", - "title": "bigtable updateCluster Sample", - "origin": "API_DEFINITION", - "description": " Updates a cluster within an instance. Note that UpdateCluster does not support updating cluster_config.cluster_autoscaling_config. In order to update it, you must use PartialUpdateCluster.", - "canonical": true, - "file": "bigtable_instance_admin.update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.bigtable.admin.v2.Cluster.State" - }, - { - "name": "serve_nodes", - "type": "TYPE_INT32" - }, - { - "name": "cluster_config", - "type": ".google.bigtable.admin.v2.Cluster.ClusterConfig" - }, - { - "name": "default_storage_type", - "type": ".google.bigtable.admin.v2.StorageType" - }, - { - "name": "encryption_config", - "type": ".google.bigtable.admin.v2.Cluster.EncryptionConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "UpdateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateCluster", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async", - "title": "bigtable partialUpdateCluster Sample", - "origin": "API_DEFINITION", - "description": " Partially updates a cluster within a project. This method is the preferred way to update a Cluster. To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the update_mask. To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set a serve_node count via the update_mask.", - "canonical": true, - "file": "bigtable_instance_admin.partial_update_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PartialUpdateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateCluster", - "async": true, - "parameters": [ - { - "name": "cluster", - "type": ".google.bigtable.admin.v2.Cluster" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "PartialUpdateCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateCluster", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async", - "title": "bigtable deleteCluster Sample", - "origin": "API_DEFINITION", - "description": " Deletes a cluster from an instance.", - "canonical": true, - "file": "bigtable_instance_admin.delete_cluster.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteCluster", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "DeleteCluster", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteCluster", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async", - "title": "bigtable createAppProfile Sample", - "origin": "API_DEFINITION", - "description": " Creates an app profile within an instance.", - "canonical": true, - "file": "bigtable_instance_admin.create_app_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateAppProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "app_profile", - "type": ".google.bigtable.admin.v2.AppProfile" - }, - { - "name": "ignore_warnings", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.bigtable.admin.v2.AppProfile", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "CreateAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.CreateAppProfile", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async", - "title": "bigtable getAppProfile Sample", - "origin": "API_DEFINITION", - "description": " Gets information about an app profile.", - "canonical": true, - "file": "bigtable_instance_admin.get_app_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetAppProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.AppProfile", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "GetAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetAppProfile", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async", - "title": "bigtable listAppProfiles Sample", - "origin": "API_DEFINITION", - "description": " Lists information about app profiles in an instance.", - "canonical": true, - "file": "bigtable_instance_admin.list_app_profiles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAppProfiles", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListAppProfiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListAppProfilesResponse", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "ListAppProfiles", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListAppProfiles", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async", - "title": "bigtable updateAppProfile Sample", - "origin": "API_DEFINITION", - "description": " Updates an app profile within an instance.", - "canonical": true, - "file": "bigtable_instance_admin.update_app_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateAppProfile", - "async": true, - "parameters": [ - { - "name": "app_profile", - "type": ".google.bigtable.admin.v2.AppProfile" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "ignore_warnings", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "UpdateAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateAppProfile", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async", - "title": "bigtable deleteAppProfile Sample", - "origin": "API_DEFINITION", - "description": " Deletes an app profile from an instance.", - "canonical": true, - "file": "bigtable_instance_admin.delete_app_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteAppProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ignore_warnings", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "DeleteAppProfile", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteAppProfile", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async", - "title": "bigtable getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.", - "canonical": true, - "file": "bigtable_instance_admin.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.GetIamPolicy", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async", - "title": "bigtable setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on an instance resource. Replaces any existing policy.", - "canonical": true, - "file": "bigtable_instance_admin.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.SetIamPolicy", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async", - "title": "bigtable testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that the caller has on the specified instance resource.", - "canonical": true, - "file": "bigtable_instance_admin.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.TestIamPermissions", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async", - "title": "bigtable listHotTablets Sample", - "origin": "API_DEFINITION", - "description": " Lists hot tablets in a cluster, within the time range provided. Hot tablets are ordered based on CPU usage.", - "canonical": true, - "file": "bigtable_instance_admin.list_hot_tablets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHotTablets", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListHotTabletsResponse", - "client": { - "shortName": "BigtableInstanceAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" - }, - "method": { - "shortName": "ListHotTablets", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", - "service": { - "shortName": "BigtableInstanceAdmin", - "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async", - "title": "bigtable createTable Sample", - "origin": "API_DEFINITION", - "description": " Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.", - "canonical": true, - "file": "bigtable_table_admin.create_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTable", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.bigtable.admin.v2.Table" - }, - { - "name": "initial_splits", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.admin.v2.Table", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "CreateTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTable", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async", - "title": "bigtable createTableFromSnapshot Sample", - "origin": "API_DEFINITION", - "description": " Creates a new table from the specified snapshot. The target table must not exist. The snapshot and the table must be in the same instance. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", - "canonical": true, - "file": "bigtable_table_admin.create_table_from_snapshot.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTableFromSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "source_snapshot", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "CreateTableFromSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async", - "title": "bigtable listTables Sample", - "origin": "API_DEFINITION", - "description": " Lists all tables served from a specified instance.", - "canonical": true, - "file": "bigtable_table_admin.list_tables.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTables", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListTables", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.bigtable.admin.v2.Table.View" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListTablesResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "ListTables", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListTables", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async", - "title": "bigtable getTable Sample", - "origin": "API_DEFINITION", - "description": " Gets metadata information about the specified table.", - "canonical": true, - "file": "bigtable_table_admin.get_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetTable", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.bigtable.admin.v2.Table.View" - } - ], - "resultType": ".google.bigtable.admin.v2.Table", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "GetTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetTable", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async", - "title": "bigtable deleteTable Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes a specified table and all of its data.", - "canonical": true, - "file": "bigtable_table_admin.delete_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "DeleteTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async", - "title": "bigtable modifyColumnFamilies Sample", - "origin": "API_DEFINITION", - "description": " Performs a series of column family modifications on the specified table. Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.", - "canonical": true, - "file": "bigtable_table_admin.modify_column_families.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ModifyColumnFamilies", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "modifications", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.admin.v2.Table", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "ModifyColumnFamilies", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async", - "title": "bigtable dropRowRange Sample", - "origin": "API_DEFINITION", - "description": " Permanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix.", - "canonical": true, - "file": "bigtable_table_admin.drop_row_range.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DropRowRange", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "row_key_prefix", - "type": "TYPE_BYTES" - }, - { - "name": "delete_all_data_from_table", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "DropRowRange", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async", - "title": "bigtable generateConsistencyToken Sample", - "origin": "API_DEFINITION", - "description": " Generates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.", - "canonical": true, - "file": "bigtable_table_admin.generate_consistency_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateConsistencyToken", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.GenerateConsistencyTokenResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "GenerateConsistencyToken", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async", - "title": "bigtable checkConsistency Sample", - "origin": "API_DEFINITION", - "description": " Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.", - "canonical": true, - "file": "bigtable_table_admin.check_consistency.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckConsistency", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "consistency_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.CheckConsistencyResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "CheckConsistency", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async", - "title": "bigtable snapshotTable Sample", - "origin": "API_DEFINITION", - "description": " Creates a new snapshot in the specified cluster from the specified source table. The cluster and the table must be in the same instance. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", - "canonical": true, - "file": "bigtable_table_admin.snapshot_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SnapshotTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "cluster", - "type": "TYPE_STRING" - }, - { - "name": "snapshot_id", - "type": "TYPE_STRING" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - }, - { - "name": "description", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "SnapshotTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async", - "title": "bigtable getSnapshot Sample", - "origin": "API_DEFINITION", - "description": " Gets metadata information about the specified snapshot. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", - "canonical": true, - "file": "bigtable_table_admin.get_snapshot.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.Snapshot", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "GetSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async", - "title": "bigtable listSnapshots Sample", - "origin": "API_DEFINITION", - "description": " Lists all snapshots associated with the specified cluster. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", - "canonical": true, - "file": "bigtable_table_admin.list_snapshots.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSnapshots", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListSnapshotsResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "ListSnapshots", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async", - "title": "bigtable deleteSnapshot Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes the specified snapshot. Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.", - "canonical": true, - "file": "bigtable_table_admin.delete_snapshot.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "DeleteSnapshot", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async", - "title": "bigtable createBackup Sample", - "origin": "API_DEFINITION", - "description": " Starts creating a new Cloud Bigtable Backup. The returned backup [long-running operation][google.longrunning.Operation] can be used to track creation of the backup. The [metadata][google.longrunning.Operation.metadata] field type is [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the creation and delete the backup.", - "canonical": true, - "file": "bigtable_table_admin.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.bigtable.admin.v2.Backup" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async", - "title": "bigtable getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets metadata on a pending or completed Cloud Bigtable Backup.", - "canonical": true, - "file": "bigtable_table_admin.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.Backup", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetBackup", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async", - "title": "bigtable updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Updates a pending or completed Cloud Bigtable Backup.", - "canonical": true, - "file": "bigtable_table_admin.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.bigtable.admin.v2.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.bigtable.admin.v2.Backup", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async", - "title": "bigtable deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a pending or completed Cloud Bigtable backup.", - "canonical": true, - "file": "bigtable_table_admin.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async", - "title": "bigtable listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists Cloud Bigtable backups. Returns both completed and pending backups.", - "canonical": true, - "file": "bigtable_table_admin.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 118, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.admin.v2.ListBackupsResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.ListBackups", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async", - "title": "bigtable restoreTable Sample", - "origin": "API_DEFINITION", - "description": " Create a new table by restoring from a completed backup. The new table must be in the same project as the instance containing the backup. The returned table [long-running operation][google.longrunning.Operation] can be used to track the progress of the operation, and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The [response][google.longrunning.Operation.response] type is [Table][google.bigtable.admin.v2.Table], if successful.", - "canonical": true, - "file": "bigtable_table_admin.restore_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "RestoreTable", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async", - "title": "bigtable getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a Table or Backup resource. Returns an empty policy if the resource exists but does not have a policy set.", - "canonical": true, - "file": "bigtable_table_admin.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.GetIamPolicy", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async", - "title": "bigtable setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on a Table or Backup resource. Replaces any existing policy.", - "canonical": true, - "file": "bigtable_table_admin.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.SetIamPolicy", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - }, - { - "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async", - "title": "bigtable testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that the caller has on the specified Table or Backup resource.", - "canonical": true, - "file": "bigtable_table_admin.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "BigtableTableAdminClient", - "fullName": "google.bigtable.admin.v2.BigtableTableAdminClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin.TestIamPermissions", - "service": { - "shortName": "BigtableTableAdmin", - "fullName": "google.bigtable.admin.v2.BigtableTableAdmin" - } - } - } - } - ] -} diff --git a/owl-bot-staging/admin/v2/src/index.ts b/owl-bot-staging/admin/v2/src/index.ts deleted file mode 100644 index dcfbea90f..000000000 --- a/owl-bot-staging/admin/v2/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const BigtableInstanceAdminClient = v2.BigtableInstanceAdminClient; -type BigtableInstanceAdminClient = v2.BigtableInstanceAdminClient; -const BigtableTableAdminClient = v2.BigtableTableAdminClient; -type BigtableTableAdminClient = v2.BigtableTableAdminClient; -export {v2, BigtableInstanceAdminClient, BigtableTableAdminClient}; -export default {v2, BigtableInstanceAdminClient, BigtableTableAdminClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts deleted file mode 100644 index 66d8812d5..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts +++ /dev/null @@ -1,2869 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/bigtable_instance_admin_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './bigtable_instance_admin_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for creating, configuring, and deleting Cloud Bigtable Instances and - * Clusters. Provides access to the Instance and Cluster schemas only, not the - * tables' metadata or data stored in those tables. - * @class - * @memberof v2 - */ -export class BigtableInstanceAdminClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - bigtableInstanceAdminStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BigtableInstanceAdminClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BigtableInstanceAdminClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - appProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/appProfiles/{app_profile}' - ), - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}' - ), - clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}' - ), - hotTabletPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}' - ), - tablePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/tables/{table}' - ), - }; - - // 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 = { - listAppProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'appProfiles'), - listHotTablets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hotTablets') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateInstanceMetadata') as gax.protobuf.Type; - const partialUpdateInstanceResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Instance') as gax.protobuf.Type; - const partialUpdateInstanceMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateInstanceMetadata') as gax.protobuf.Type; - const createClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; - const createClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateClusterMetadata') as gax.protobuf.Type; - const updateClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; - const updateClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateClusterMetadata') as gax.protobuf.Type; - const partialUpdateClusterResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Cluster') as gax.protobuf.Type; - const partialUpdateClusterMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.PartialUpdateClusterMetadata') as gax.protobuf.Type; - const updateAppProfileResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.AppProfile') as gax.protobuf.Type; - const updateAppProfileMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.UpdateAppProfileMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - partialUpdateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - partialUpdateInstanceResponse.decode.bind(partialUpdateInstanceResponse), - partialUpdateInstanceMetadata.decode.bind(partialUpdateInstanceMetadata)), - 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)), - partialUpdateCluster: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - partialUpdateClusterResponse.decode.bind(partialUpdateClusterResponse), - partialUpdateClusterMetadata.decode.bind(partialUpdateClusterMetadata)), - updateAppProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateAppProfileResponse.decode.bind(updateAppProfileResponse), - updateAppProfileMetadata.decode.bind(updateAppProfileMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.bigtable.admin.v2.BigtableInstanceAdmin', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.bigtableInstanceAdminStub) { - return this.bigtableInstanceAdminStub; - } - - // Put together the "service stub" for - // google.bigtable.admin.v2.BigtableInstanceAdmin. - this.bigtableInstanceAdminStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableInstanceAdmin') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.bigtable.admin.v2.BigtableInstanceAdmin, - 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 bigtableInstanceAdminStubMethods = - ['createInstance', 'getInstance', 'listInstances', 'updateInstance', 'partialUpdateInstance', 'deleteInstance', 'createCluster', 'getCluster', 'listClusters', 'updateCluster', 'partialUpdateCluster', 'deleteCluster', 'createAppProfile', 'getAppProfile', 'listAppProfiles', 'updateAppProfile', 'deleteAppProfile', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', 'listHotTablets']; - for (const methodName of bigtableInstanceAdminStubMethods) { - const callPromise = this.bigtableInstanceAdminStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.bigtableInstanceAdminStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'bigtableadmin.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 'bigtableadmin.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/bigtable.admin', - 'https://www.googleapis.com/auth/bigtable.admin.cluster', - 'https://www.googleapis.com/auth/bigtable.admin.instance', - 'https://www.googleapis.com/auth/cloud-bigtable.admin', - 'https://www.googleapis.com/auth/cloud-bigtable.admin.cluster', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - 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 information about an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested instance. Values are of the form - * `projects/{project}/instances/{instance}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.bigtable.admin.v2.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetInstance_async - */ - getInstance( - request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.bigtable.admin.v2.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.bigtable.admin.v2.IGetInstanceRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.bigtable.admin.v2.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IGetInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getInstance(request, options, callback); - } -/** - * Lists information about instances in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the project for which a list of instances is requested. - * Values are of the form `projects/{project}`. - * @param {string} request.pageToken - * DEPRECATED: This field is unused and ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListInstancesResponse]{@link google.bigtable.admin.v2.ListInstancesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListInstances_async - */ - listInstances( - request?: protos.google.bigtable.admin.v2.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined - ]>; - listInstances( - request: protos.google.bigtable.admin.v2.IListInstancesRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, - {}|null|undefined>): void; - listInstances( - request: protos.google.bigtable.admin.v2.IListInstancesRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, - {}|null|undefined>): void; - listInstances( - request?: protos.google.bigtable.admin.v2.IListInstancesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IListInstancesResponse, - protos.google.bigtable.admin.v2.IListInstancesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listInstances(request, options, callback); - } -/** - * Updates an instance within a project. This method updates only the display - * name and type for an Instance. To update other Instance properties, such as - * labels, use PartialUpdateInstance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The unique name of the instance. Values are of the form - * `projects/{project}/instances/{@link a-z0-9\\-|a-z}+[a-z0-9]`. - * @param {string} request.displayName - * Required. The descriptive name for this instance as it appears in UIs. - * Can be changed at any time, but should be kept globally unique - * to avoid confusion. - * @param {google.bigtable.admin.v2.Instance.State} request.state - * (`OutputOnly`) - * The current state of the instance. - * @param {google.bigtable.admin.v2.Instance.Type} request.type - * The type of the instance. Defaults to `PRODUCTION`. - * @param {number[]} request.labels - * Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. They can be used to filter resources and aggregate - * metrics. - * - * * Label keys must be between 1 and 63 characters long and must conform to - * the regular expression: `{@link \p{Ll}\p{Lo}\p{N}_-|\p{Ll}\p{Lo}}{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform to - * the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * * Keys and values must both be under 128 bytes. - * @param {google.protobuf.Timestamp} request.createTime - * Output only. A server-assigned timestamp representing when this Instance was created. - * For instances created before this field was added (August 2021), this value - * is `seconds: 0, nanos: 1`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.bigtable.admin.v2.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async - */ - updateInstance( - request?: protos.google.bigtable.admin.v2.IInstance, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.bigtable.admin.v2.IInstance, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.bigtable.admin.v2.IInstance, - callback: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.bigtable.admin.v2.IInstance, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IInstance, - protos.google.bigtable.admin.v2.IInstance|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateInstance(request, options, callback); - } -/** - * Delete an instance from a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the instance to be deleted. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.bigtable.admin.v2.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteInstance(request, options, callback); - } -/** - * Gets information about a cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Cluster]{@link google.bigtable.admin.v2.Cluster}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetCluster_async - */ - getCluster( - request?: protos.google.bigtable.admin.v2.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest|undefined, {}|undefined - ]>; - getCluster( - request: protos.google.bigtable.admin.v2.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request: protos.google.bigtable.admin.v2.IGetClusterRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; - getCluster( - request?: protos.google.bigtable.admin.v2.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ICluster, - protos.google.bigtable.admin.v2.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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getCluster(request, options, callback); - } -/** - * Lists information about clusters in an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of clusters is requested. - * Values are of the form `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list Clusters for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {string} request.pageToken - * DEPRECATED: This field is unused and ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListClustersResponse]{@link google.bigtable.admin.v2.ListClustersResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListClusters_async - */ - listClusters( - request?: protos.google.bigtable.admin.v2.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined - ]>; - listClusters( - request: protos.google.bigtable.admin.v2.IListClustersRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request: protos.google.bigtable.admin.v2.IListClustersRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, - {}|null|undefined>): void; - listClusters( - request?: protos.google.bigtable.admin.v2.IListClustersRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IListClustersResponse, - protos.google.bigtable.admin.v2.IListClustersRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listClusters(request, options, callback); - } -/** - * Deletes a cluster from an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the cluster to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteCluster_async - */ - deleteCluster( - request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined - ]>; - deleteCluster( - request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): void; - deleteCluster( - request?: protos.google.bigtable.admin.v2.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteClusterRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteCluster(request, options, callback); - } -/** - * Creates an app profile within an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the new app profile. - * Values are of the form - * `projects/{project}/instances/{instance}`. - * @param {string} request.appProfileId - * Required. The ID to be used when referring to the new app profile within its - * instance, e.g., just `myprofile` rather than - * `projects/myproject/instances/myinstance/appProfiles/myprofile`. - * @param {google.bigtable.admin.v2.AppProfile} request.appProfile - * Required. The app profile to be created. - * Fields marked `OutputOnly` will be ignored. - * @param {boolean} request.ignoreWarnings - * If true, ignore safety checks when creating the app profile. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateAppProfile_async - */ - createAppProfile( - request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined - ]>; - createAppProfile( - request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, - {}|null|undefined>): void; - createAppProfile( - request: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, - {}|null|undefined>): void; - createAppProfile( - request?: protos.google.bigtable.admin.v2.ICreateAppProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.ICreateAppProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createAppProfile(request, options, callback); - } -/** - * Gets information about an app profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested app profile. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetAppProfile_async - */ - getAppProfile( - request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined - ]>; - getAppProfile( - request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, - {}|null|undefined>): void; - getAppProfile( - request: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, - {}|null|undefined>): void; - getAppProfile( - request?: protos.google.bigtable.admin.v2.IGetAppProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile, - protos.google.bigtable.admin.v2.IGetAppProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getAppProfile(request, options, callback); - } -/** - * Deletes an app profile from an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the app profile to be deleted. Values are of the form - * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. - * @param {boolean} request.ignoreWarnings - * Required. If true, ignore safety checks when deleting the app profile. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_DeleteAppProfile_async - */ - deleteAppProfile( - request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined - ]>; - deleteAppProfile( - request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, - {}|null|undefined>): void; - deleteAppProfile( - request: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, - {}|null|undefined>): void; - deleteAppProfile( - request?: protos.google.bigtable.admin.v2.IDeleteAppProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteAppProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAppProfile(request, options, callback); - } -/** - * Gets the access control policy for an instance resource. Returns an empty - * policy if an instance exists but 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 {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Sets the access control policy on an instance resource. Replaces any - * existing policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns permissions that the caller has on the specified instance resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } - -/** - * Create an instance within a project. - * - * Note that exactly one of Cluster.serve_nodes and - * Cluster.cluster_config.cluster_autoscaling_config can be set. If - * serve_nodes is set to non-zero, then the cluster is manually scaled. If - * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the project in which to create the new instance. - * Values are of the form `projects/{project}`. - * @param {string} request.instanceId - * Required. The ID to be used when referring to the new instance within its project, - * e.g., just `myinstance` rather than - * `projects/myproject/instances/myinstance`. - * @param {google.bigtable.admin.v2.Instance} request.instance - * Required. The instance to create. - * Fields marked `OutputOnly` must be left blank. - * @param {number[]} request.clusters - * Required. The clusters to be created within the instance, mapped by desired - * cluster ID, e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - * Fields marked `OutputOnly` must be left blank. - * Currently, at most four clusters can be specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async - */ - createInstance( - request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.bigtable.admin.v2.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Partially updates an instance within a project. This method can modify all - * fields of an Instance and is the preferred way to update an Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Instance} request.instance - * Required. The Instance which will (partially) replace the current value. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of Instance fields which should be replaced. - * Must be explicitly set. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async - */ - partialUpdateInstance( - request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - partialUpdateInstance( - request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - partialUpdateInstance( - request: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - partialUpdateInstance( - request?: protos.google.bigtable.admin.v2.IPartialUpdateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'instance.name': request.instance!.name || '', - }); - this.initialize(); - return this.innerApiCalls.partialUpdateInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `partialUpdateInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateInstance_async - */ - async checkPartialUpdateInstanceProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateInstance, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a cluster within an instance. - * - * Note that exactly one of Cluster.serve_nodes and - * Cluster.cluster_config.cluster_autoscaling_config can be set. If - * serve_nodes is set to non-zero, then the cluster is manually scaled. If - * cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the new cluster. - * Values are of the form - * `projects/{project}/instances/{instance}`. - * @param {string} request.clusterId - * Required. The ID to be used when referring to the new cluster within its instance, - * e.g., just `mycluster` rather than - * `projects/myproject/instances/myinstance/clusters/mycluster`. - * @param {google.bigtable.admin.v2.Cluster} request.cluster - * Required. The cluster to be created. - * Fields marked `OutputOnly` must be left blank. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async - */ - createCluster( - request?: protos.google.bigtable.admin.v2.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createCluster( - request: protos.google.bigtable.admin.v2.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request: protos.google.bigtable.admin.v2.ICreateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createCluster( - request?: protos.google.bigtable.admin.v2.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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - 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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_CreateCluster_async - */ - async checkCreateClusterProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createCluster, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a cluster within an instance. - * - * Note that UpdateCluster does not support updating - * cluster_config.cluster_autoscaling_config. In order to update it, you - * must use PartialUpdateCluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The unique name of the cluster. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{@link -a-z0-9|a-z}*`. - * @param {string} request.location - * (`CreationOnly`) - * The location where this cluster's nodes and storage reside. For best - * performance, clients should be located as close as possible to this - * cluster. Currently only zones are supported, so values should be of the - * form `projects/{project}/locations/{zone}`. - * @param {google.bigtable.admin.v2.Cluster.State} request.state - * The current state of the cluster. - * @param {number} request.serveNodes - * The number of nodes allocated to this cluster. More nodes enable higher - * throughput and more consistent performance. - * @param {google.bigtable.admin.v2.Cluster.ClusterConfig} request.clusterConfig - * Configuration for this cluster. - * @param {google.bigtable.admin.v2.StorageType} request.defaultStorageType - * (`CreationOnly`) - * The type of storage used by this cluster to serve its - * parent instance's tables, unless explicitly overridden. - * @param {google.bigtable.admin.v2.Cluster.EncryptionConfig} request.encryptionConfig - * Immutable. The encryption configuration for CMEK-protected clusters. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async - */ - updateCluster( - request?: protos.google.bigtable.admin.v2.ICluster, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateCluster( - request: protos.google.bigtable.admin.v2.ICluster, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request: protos.google.bigtable.admin.v2.ICluster, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateCluster( - request?: protos.google.bigtable.admin.v2.ICluster, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateCluster_async - */ - async checkUpdateClusterProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateCluster, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Partially updates a cluster within a project. This method is the preferred - * way to update a Cluster. - * - * To enable and update autoscaling, set - * cluster_config.cluster_autoscaling_config. When autoscaling is enabled, - * serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it - * are ignored. Note that an update cannot simultaneously set serve_nodes to - * non-zero and cluster_config.cluster_autoscaling_config to non-empty, and - * also specify both in the update_mask. - * - * To disable autoscaling, clear cluster_config.cluster_autoscaling_config, - * and explicitly set a serve_node count via the update_mask. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Cluster} request.cluster - * Required. The Cluster which contains the partial updates to be applied, subject to - * the update_mask. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of Cluster fields which should be replaced. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async - */ - partialUpdateCluster( - request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - partialUpdateCluster( - request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - partialUpdateCluster( - request: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - partialUpdateCluster( - request?: protos.google.bigtable.admin.v2.IPartialUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'cluster.name': request.cluster!.name || '', - }); - this.initialize(); - return this.innerApiCalls.partialUpdateCluster(request, options, callback); - } -/** - * Check the status of the long running operation returned by `partialUpdateCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_PartialUpdateCluster_async - */ - async checkPartialUpdateClusterProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.partialUpdateCluster, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates an app profile within an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.AppProfile} request.appProfile - * Required. The app profile which will (partially) replace the current value. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The subset of app profile fields which should be replaced. - * If unset, all fields will be replaced. - * @param {boolean} request.ignoreWarnings - * If true, ignore safety checks when updating the app profile. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async - */ - updateAppProfile( - request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateAppProfile( - request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAppProfile( - request: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateAppProfile( - request?: protos.google.bigtable.admin.v2.IUpdateAppProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'app_profile.name': request.appProfile!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateAppProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateAppProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateAppProfile_async - */ - async checkUpdateAppProfileProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateAppProfile, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists information about app profiles in an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. - * 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 `listAppProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAppProfiles( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile[], - protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, - protos.google.bigtable.admin.v2.IListAppProfilesResponse - ]>; - listAppProfiles( - request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, - protos.google.bigtable.admin.v2.IAppProfile>): void; - listAppProfiles( - request: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, - protos.google.bigtable.admin.v2.IAppProfile>): void; - listAppProfiles( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, - protos.google.bigtable.admin.v2.IAppProfile>, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListAppProfilesRequest, - protos.google.bigtable.admin.v2.IListAppProfilesResponse|null|undefined, - protos.google.bigtable.admin.v2.IAppProfile>): - Promise<[ - protos.google.bigtable.admin.v2.IAppProfile[], - protos.google.bigtable.admin.v2.IListAppProfilesRequest|null, - protos.google.bigtable.admin.v2.IListAppProfilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAppProfiles(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 unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 [AppProfile]{@link google.bigtable.admin.v2.AppProfile} 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 `listAppProfilesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAppProfilesStream( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAppProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAppProfiles.createStream( - this.innerApiCalls.listAppProfiles as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAppProfiles`, 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 unique name of the instance for which a list of app profiles is - * requested. Values are of the form - * `projects/{project}/instances/{instance}`. - * Use `{instance} = '-'` to list AppProfiles for all Instances in a project, - * e.g., `projects/myproject/instances/-`. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [AppProfile]{@link google.bigtable.admin.v2.AppProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListAppProfiles_async - */ - listAppProfilesAsync( - request?: protos.google.bigtable.admin.v2.IListAppProfilesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAppProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAppProfiles.asyncIterate( - this.innerApiCalls['listAppProfiles'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists hot tablets in a cluster, within the time range provided. Hot - * tablets are ordered based on CPU usage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. - * 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 `listHotTabletsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listHotTablets( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IHotTablet[], - protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, - protos.google.bigtable.admin.v2.IListHotTabletsResponse - ]>; - listHotTablets( - request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, - protos.google.bigtable.admin.v2.IHotTablet>): void; - listHotTablets( - request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, - protos.google.bigtable.admin.v2.IHotTablet>): void; - listHotTablets( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, - protos.google.bigtable.admin.v2.IHotTablet>, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListHotTabletsRequest, - protos.google.bigtable.admin.v2.IListHotTabletsResponse|null|undefined, - protos.google.bigtable.admin.v2.IHotTablet>): - Promise<[ - protos.google.bigtable.admin.v2.IHotTablet[], - protos.google.bigtable.admin.v2.IListHotTabletsRequest|null, - protos.google.bigtable.admin.v2.IListHotTabletsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listHotTablets(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 cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet} 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 `listHotTabletsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listHotTabletsStream( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHotTablets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHotTablets.createStream( - this.innerApiCalls.listHotTablets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHotTablets`, 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 cluster name to list hot tablets. - * Value is in the following form: - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {google.protobuf.Timestamp} request.startTime - * The start time to list hot tablets. The hot tablets in the response will - * have start times between the requested start time and end time. Start time - * defaults to Now if it is unset, and end time defaults to Now - 24 hours if - * it is unset. The start time should be less than the end time, and the - * maximum allowed time range between start time and end time is 48 hours. - * Start time and end time should have values between Now and Now - 14 days. - * @param {google.protobuf.Timestamp} request.endTime - * The end time to list hot tablets. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size that is empty or zero lets the server choose the number of - * items to return. A page_size which is strictly positive will return at most - * that many items. A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls do not need a - * page_size field. If a page_size is set in subsequent calls, it must match - * the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async - */ - listHotTabletsAsync( - request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHotTablets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHotTablets.asyncIterate( - this.innerApiCalls['listHotTablets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified appProfile resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} app_profile - * @returns {string} Resource name string. - */ - appProfilePath(project:string,instance:string,appProfile:string) { - return this.pathTemplates.appProfilePathTemplate.render({ - project: project, - instance: instance, - app_profile: appProfile, - }); - } - - /** - * Parse the project from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; - } - - /** - * Parse the instance from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; - } - - /** - * Parse the app_profile from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the app_profile. - */ - matchAppProfileFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; - } - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,instance:string,cluster:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the instance from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).instance; - } - - /** - * Parse the cluster from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).cluster; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified cluster resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @returns {string} Resource name string. - */ - clusterPath(project:string,instance:string,cluster:string) { - return this.pathTemplates.clusterPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - }); - } - - /** - * Parse the project from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).project; - } - - /** - * Parse the instance from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).instance; - } - - /** - * Parse the cluster from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; - } - - /** - * Return a fully-qualified hotTablet resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} hot_tablet - * @returns {string} Resource name string. - */ - hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { - return this.pathTemplates.hotTabletPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - hot_tablet: hotTablet, - }); - } - - /** - * Parse the project from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; - } - - /** - * Parse the instance from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; - } - - /** - * Parse the cluster from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; - } - - /** - * Parse the hot_tablet from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the hot_tablet. - */ - matchHotTabletFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * 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 snapshot resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the instance from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; - } - - /** - * Parse the cluster from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).cluster; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * Return a fully-qualified table resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} table - * @returns {string} Resource name string. - */ - tablePath(project:string,instance:string,table:string) { - return this.pathTemplates.tablePathTemplate.render({ - project: project, - instance: instance, - table: table, - }); - } - - /** - * Parse the project from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).project; - } - - /** - * Parse the instance from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).instance; - } - - /** - * Parse the table from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the table. - */ - matchTableFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).table; - } - - /** - * 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.bigtableInstanceAdminStub && !this._terminated) { - return this.bigtableInstanceAdminStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json deleted file mode 100644 index bb5e050c1..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "interfaces": { - "google.bigtable.admin.v2.BigtableInstanceAdmin": { - "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 - }, - "264268458a9e88347dbacbd9398202ff5885a40b": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateInstance": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListInstances": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateInstance": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "PartialUpdateInstance": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteInstance": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetCluster": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListClusters": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateCluster": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "PartialUpdateCluster": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteCluster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAppProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAppProfile": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListAppProfiles": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateAppProfile": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteAppProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListHotTablets": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - } - } - } - } -} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json deleted file mode 100644 index 1f7e1af50..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_proto_list.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/bigtable/admin/v2/bigtable_instance_admin.proto", - "../../protos/google/bigtable/admin/v2/bigtable_table_admin.proto", - "../../protos/google/bigtable/admin/v2/common.proto", - "../../protos/google/bigtable/admin/v2/instance.proto", - "../../protos/google/bigtable/admin/v2/table.proto" -] diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts deleted file mode 100644 index 77b48f59d..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts +++ /dev/null @@ -1,3142 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/bigtable_table_admin_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './bigtable_table_admin_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Service for creating, configuring, and deleting Cloud Bigtable tables. - * - * - * Provides access to the table schemas only, not the data stored within - * the tables. - * @class - * @memberof v2 - */ -export class BigtableTableAdminClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - bigtableTableAdminStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BigtableTableAdminClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BigtableTableAdminClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - appProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/appProfiles/{app_profile}' - ), - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}' - ), - clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}' - ), - hotTabletPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}' - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}' - ), - tablePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/tables/{table}' - ), - }; - - // 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 = { - listTables: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tables'), - listSnapshots: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'snapshots'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createTableFromSnapshotResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; - const createTableFromSnapshotMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata') as gax.protobuf.Type; - const snapshotTableResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Snapshot') as gax.protobuf.Type; - const snapshotTableMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.SnapshotTableMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.CreateBackupMetadata') as gax.protobuf.Type; - const restoreTableResponse = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.Table') as gax.protobuf.Type; - const restoreTableMetadata = protoFilesRoot.lookup( - '.google.bigtable.admin.v2.RestoreTableMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createTableFromSnapshot: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createTableFromSnapshotResponse.decode.bind(createTableFromSnapshotResponse), - createTableFromSnapshotMetadata.decode.bind(createTableFromSnapshotMetadata)), - snapshotTable: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - snapshotTableResponse.decode.bind(snapshotTableResponse), - snapshotTableMetadata.decode.bind(snapshotTableMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - restoreTable: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreTableResponse.decode.bind(restoreTableResponse), - restoreTableMetadata.decode.bind(restoreTableMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.bigtable.admin.v2.BigtableTableAdmin', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.bigtableTableAdminStub) { - return this.bigtableTableAdminStub; - } - - // Put together the "service stub" for - // google.bigtable.admin.v2.BigtableTableAdmin. - this.bigtableTableAdminStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.bigtable.admin.v2.BigtableTableAdmin') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.bigtable.admin.v2.BigtableTableAdmin, - 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 bigtableTableAdminStubMethods = - ['createTable', 'createTableFromSnapshot', 'listTables', 'getTable', 'deleteTable', 'modifyColumnFamilies', 'dropRowRange', 'generateConsistencyToken', 'checkConsistency', 'snapshotTable', 'getSnapshot', 'listSnapshots', 'deleteSnapshot', 'createBackup', 'getBackup', 'updateBackup', 'deleteBackup', 'listBackups', 'restoreTable', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; - for (const methodName of bigtableTableAdminStubMethods) { - const callPromise = this.bigtableTableAdminStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.bigtableTableAdminStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'bigtableadmin.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 'bigtableadmin.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/bigtable.admin', - 'https://www.googleapis.com/auth/bigtable.admin.table', - 'https://www.googleapis.com/auth/cloud-bigtable.admin', - 'https://www.googleapis.com/auth/cloud-bigtable.admin.table', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - 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 a new table in the specified instance. - * The table can be created with a full set of initial column families, - * specified in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {string} request.tableId - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - * Maximum 50 characters. - * @param {google.bigtable.admin.v2.Table} request.table - * Required. The Table to create. - * @param {number[]} request.initialSplits - * The optional list of row keys that will be used to initially split the - * table into several tablets (tablets are similar to HBase regions). - * Given two split keys, `s1` and `s2`, three tablets will be created, - * spanning the key ranges: `[, s1), [s1, s2), [s2, )`. - * - * Example: - * - * * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` - * `"other", "zz"]` - * * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` - * * Key assignment: - * - Tablet 1 `[, apple) => {"a"}.` - * - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` - * - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` - * - Tablet 4 `[customer_2, other) => {"customer_2"}.` - * - Tablet 5 `[other, ) => {"other", "zz"}.` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async - */ - createTable( - request?: protos.google.bigtable.admin.v2.ICreateTableRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined - ]>; - createTable( - request: protos.google.bigtable.admin.v2.ICreateTableRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, - {}|null|undefined>): void; - createTable( - request: protos.google.bigtable.admin.v2.ICreateTableRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, - {}|null|undefined>): void; - createTable( - request?: protos.google.bigtable.admin.v2.ICreateTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.ICreateTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createTable(request, options, callback); - } -/** - * Gets metadata information about the specified table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested table. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned table's fields. - * Defaults to `SCHEMA_VIEW` if unspecified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetTable_async - */ - getTable( - request?: protos.google.bigtable.admin.v2.IGetTableRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined - ]>; - getTable( - request: protos.google.bigtable.admin.v2.IGetTableRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request: protos.google.bigtable.admin.v2.IGetTableRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request?: protos.google.bigtable.admin.v2.IGetTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IGetTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getTable(request, options, callback); - } -/** - * Permanently deletes a specified table and all of its data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteTable_async - */ - deleteTable( - request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined - ]>; - deleteTable( - request: protos.google.bigtable.admin.v2.IDeleteTableRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request: protos.google.bigtable.admin.v2.IDeleteTableRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request?: protos.google.bigtable.admin.v2.IDeleteTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteTable(request, options, callback); - } -/** - * Performs a series of column family modifications on the specified table. - * Either all or none of the modifications will occur before this method - * returns, but data requests received prior to that point may see a table - * where only some modifications have taken effect. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table whose families should be modified. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {number[]} request.modifications - * Required. Modifications to be atomically applied to the specified table's families. - * Entries are applied in order, meaning that earlier modifications can be - * masked by later ones (in the case of repeated updates to the same family, - * for example). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Table]{@link google.bigtable.admin.v2.Table}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ModifyColumnFamilies_async - */ - modifyColumnFamilies( - request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined - ]>; - modifyColumnFamilies( - request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, - {}|null|undefined>): void; - modifyColumnFamilies( - request: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, - {}|null|undefined>): void; - modifyColumnFamilies( - request?: protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ITable, - protos.google.bigtable.admin.v2.IModifyColumnFamiliesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.modifyColumnFamilies(request, options, callback); - } -/** - * Permanently drop/delete a row range from a specified table. The request can - * specify whether to delete all rows in a table, or only those that match a - * particular prefix. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table on which to drop a range of rows. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {Buffer} request.rowKeyPrefix - * Delete all rows that start with this row key prefix. Prefix cannot be - * zero length. - * @param {boolean} request.deleteAllDataFromTable - * Delete all rows in the table. Setting this to false is a no-op. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DropRowRange_async - */ - dropRowRange( - request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined - ]>; - dropRowRange( - request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, - {}|null|undefined>): void; - dropRowRange( - request: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, - {}|null|undefined>): void; - dropRowRange( - request?: protos.google.bigtable.admin.v2.IDropRowRangeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDropRowRangeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.dropRowRange(request, options, callback); - } -/** - * Generates a consistency token for a Table, which can be used in - * CheckConsistency to check whether mutations to the table that finished - * before this call started have been replicated. The tokens will be available - * for 90 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the Table for which to create a consistency token. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GenerateConsistencyTokenResponse]{@link google.bigtable.admin.v2.GenerateConsistencyTokenResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GenerateConsistencyToken_async - */ - generateConsistencyToken( - request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined - ]>; - generateConsistencyToken( - request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, - {}|null|undefined>): void; - generateConsistencyToken( - request: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, - {}|null|undefined>): void; - generateConsistencyToken( - request?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse, - protos.google.bigtable.admin.v2.IGenerateConsistencyTokenRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.generateConsistencyToken(request, options, callback); - } -/** - * Checks replication consistency based on a consistency token, that is, if - * replication has caught up based on the conditions specified in the token - * and the check request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the Table for which to check replication consistency. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {string} request.consistencyToken - * Required. The token created using GenerateConsistencyToken for the Table. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CheckConsistencyResponse]{@link google.bigtable.admin.v2.CheckConsistencyResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CheckConsistency_async - */ - checkConsistency( - request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined - ]>; - checkConsistency( - request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, - {}|null|undefined>): void; - checkConsistency( - request: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, - {}|null|undefined>): void; - checkConsistency( - request?: protos.google.bigtable.admin.v2.ICheckConsistencyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ICheckConsistencyResponse, - protos.google.bigtable.admin.v2.ICheckConsistencyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.checkConsistency(request, options, callback); - } -/** - * Gets metadata information about the specified snapshot. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the requested snapshot. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetSnapshot_async - */ - getSnapshot( - request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined - ]>; - getSnapshot( - request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): void; - getSnapshot( - request: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - callback: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): void; - getSnapshot( - request?: protos.google.bigtable.admin.v2.IGetSnapshotRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.ISnapshot, - protos.google.bigtable.admin.v2.IGetSnapshotRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSnapshot(request, options, callback); - } -/** - * Permanently deletes the specified snapshot. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the snapshot to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteSnapshot_async - */ - deleteSnapshot( - request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined - ]>; - deleteSnapshot( - request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): void; - deleteSnapshot( - request: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): void; - deleteSnapshot( - request?: protos.google.bigtable.admin.v2.IDeleteSnapshotRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteSnapshotRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSnapshot(request, options, callback); - } -/** - * Gets metadata on a pending or completed Cloud Bigtable Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the backup. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.bigtable.admin.v2.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetBackup_async - */ - getBackup( - request?: protos.google.bigtable.admin.v2.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.bigtable.admin.v2.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.bigtable.admin.v2.IGetBackupRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.bigtable.admin.v2.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IGetBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getBackup(request, options, callback); - } -/** - * Updates a pending or completed Cloud Bigtable Backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.bigtable.admin.v2.Backup} request.backup - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.bigtable.admin.v2.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_UpdateBackup_async - */ - updateBackup( - request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined - ]>; - updateBackup( - request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; - updateBackup( - request: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - callback: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; - updateBackup( - request?: protos.google.bigtable.admin.v2.IUpdateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.admin.v2.IBackup, - protos.google.bigtable.admin.v2.IUpdateBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'backup.name': request.backup!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateBackup(request, options, callback); - } -/** - * Deletes a pending or completed Cloud Bigtable backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the backup to delete. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.bigtable.admin.v2.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.bigtable.admin.v2.IDeleteBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Gets the access control policy for a Table or Backup resource. - * Returns an empty policy if the resource exists but 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 {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Sets the access control policy on a Table or Backup resource. - * Replaces any existing policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } - -/** - * Creates a new table from the specified snapshot. The target table must - * not exist. The snapshot and the table must be in the same instance. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance in which to create the table. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {string} request.tableId - * Required. The name by which the new table should be referred to within the parent - * instance, e.g., `foobar` rather than `{parent}/tables/foobar`. - * @param {string} request.sourceSnapshot - * Required. The unique name of the snapshot from which to restore the table. The - * snapshot and the table must be in the same instance. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async - */ - createTableFromSnapshot( - request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createTableFromSnapshot( - request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createTableFromSnapshot( - request: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createTableFromSnapshot( - request?: protos.google.bigtable.admin.v2.ICreateTableFromSnapshotRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createTableFromSnapshot(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createTableFromSnapshot()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateTableFromSnapshot_async - */ - async checkCreateTableFromSnapshotProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createTableFromSnapshot, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new snapshot in the specified cluster from the specified - * source table. The cluster and the table must be in the same instance. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the table to have the snapshot taken. - * Values are of the form - * `projects/{project}/instances/{instance}/tables/{table}`. - * @param {string} request.cluster - * Required. The name of the cluster where the snapshot will be created in. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {string} request.snapshotId - * Required. The ID by which the new snapshot should be referred to within the parent - * cluster, e.g., `mysnapshot` of the form: `{@link -_.a-zA-Z0-9|_a-zA-Z0-9}*` - * rather than - * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - * @param {google.protobuf.Duration} request.ttl - * The amount of time that the new snapshot can stay active after it is - * created. Once 'ttl' expires, the snapshot will get deleted. The maximum - * amount of time a snapshot can stay active is 7 days. If 'ttl' is not - * specified, the default value of 24 hours will be used. - * @param {string} request.description - * Description of the snapshot. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async - */ - snapshotTable( - request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - snapshotTable( - request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - snapshotTable( - request: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - snapshotTable( - request?: protos.google.bigtable.admin.v2.ISnapshotTableRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.snapshotTable(request, options, callback); - } -/** - * Check the status of the long running operation returned by `snapshotTable()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_SnapshotTable_async - */ - async checkSnapshotTableProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.snapshotTable, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts creating a new Cloud Bigtable Backup. The returned backup - * {@link google.longrunning.Operation|long-running operation} can be used to - * track creation of the backup. The - * {@link google.longrunning.Operation.metadata|metadata} field type is - * {@link google.bigtable.admin.v2.CreateBackupMetadata|CreateBackupMetadata}. The - * {@link google.longrunning.Operation.response|response} field type is - * {@link google.bigtable.admin.v2.Backup|Backup}, if successful. Cancelling the returned operation will stop the - * creation and delete the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. This must be one of the clusters in the instance in which this - * table is located. The backup will be stored in this cluster. Values are - * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param {string} request.backupId - * Required. The id of the backup to be created. The `backup_id` along with - * the parent `parent` are combined as {parent}/backups/{backup_id} to create - * the full backup name, of the form: - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`. - * This string must be between 1 and 50 characters in length and match the - * regex {@link -_.a-zA-Z0-9|_a-zA-Z0-9}*. - * @param {google.bigtable.admin.v2.Backup} request.backup - * Required. The backup to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async - */ - createBackup( - request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.bigtable.admin.v2.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.bigtable.admin.v2.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.bigtable.admin.v2.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new table by restoring from a completed backup. The new table - * must be in the same project as the instance containing the backup. The - * returned table {@link google.longrunning.Operation|long-running operation} can - * be used to track the progress of the operation, and to cancel it. The - * {@link google.longrunning.Operation.metadata|metadata} field type is - * {@link google.bigtable.admin.RestoreTableMetadata|RestoreTableMetadata}. The - * {@link google.longrunning.Operation.response|response} type is - * {@link google.bigtable.admin.v2.Table|Table}, if successful. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the instance in which to create the restored - * table. This instance must be in the same project as the source backup. - * Values are of the form `projects//instances/`. - * @param {string} request.tableId - * Required. The id of the table to create and restore to. This - * table must not already exist. The `table_id` appended to - * `parent` forms the full table name of the form - * `projects//instances//tables/`. - * @param {string} request.backup - * Name of the backup from which to restore. Values are of the form - * `projects//instances//clusters//backups/`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async - */ - restoreTable( - request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreTable( - request: protos.google.bigtable.admin.v2.IRestoreTableRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreTable( - request: protos.google.bigtable.admin.v2.IRestoreTableRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreTable( - request?: protos.google.bigtable.admin.v2.IRestoreTableRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.restoreTable(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreTable()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async - */ - async checkRestoreTableProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restoreTable, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all tables served from a specified instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Table]{@link google.bigtable.admin.v2.Table}. - * 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 `listTablesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listTables( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ITable[], - protos.google.bigtable.admin.v2.IListTablesRequest|null, - protos.google.bigtable.admin.v2.IListTablesResponse - ]>; - listTables( - request: protos.google.bigtable.admin.v2.IListTablesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, - protos.google.bigtable.admin.v2.ITable>): void; - listTables( - request: protos.google.bigtable.admin.v2.IListTablesRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, - protos.google.bigtable.admin.v2.ITable>): void; - listTables( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, - protos.google.bigtable.admin.v2.ITable>, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListTablesRequest, - protos.google.bigtable.admin.v2.IListTablesResponse|null|undefined, - protos.google.bigtable.admin.v2.ITable>): - Promise<[ - protos.google.bigtable.admin.v2.ITable[], - protos.google.bigtable.admin.v2.IListTablesRequest|null, - protos.google.bigtable.admin.v2.IListTablesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listTables(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 unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 [Table]{@link google.bigtable.admin.v2.Table} 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 `listTablesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listTablesStream( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTables.createStream( - this.innerApiCalls.listTables as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTables`, 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 unique name of the instance for which tables should be listed. - * Values are of the form `projects/{project}/instances/{instance}`. - * @param {google.bigtable.admin.v2.Table.View} request.view - * The view to be applied to the returned tables' fields. - * Only NAME_ONLY view (default) and REPLICATION_VIEW are supported. - * @param {number} request.pageSize - * Maximum number of results per page. - * - * A page_size of zero lets the server choose the number of items to return. - * A page_size which is strictly positive will return at most that many items. - * A negative page_size will cause an error. - * - * Following the first request, subsequent paginated calls are not required - * to pass a page_size. If a page_size is set in subsequent calls, it must - * match the page_size given in the first request. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Table]{@link google.bigtable.admin.v2.Table}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListTables_async - */ - listTablesAsync( - request?: protos.google.bigtable.admin.v2.IListTablesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTables.asyncIterate( - this.innerApiCalls['listTables'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists all snapshots associated with the specified cluster. - * - * Note: This is a private alpha release of Cloud Bigtable snapshots. This - * feature is not currently available to most Cloud Bigtable customers. This - * feature might be changed in backward-incompatible ways and is not - * recommended for production use. It is not subject to any SLA or deprecation - * policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. - * 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 `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSnapshots( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.ISnapshot[], - protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, - protos.google.bigtable.admin.v2.IListSnapshotsResponse - ]>; - listSnapshots( - request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, - protos.google.bigtable.admin.v2.ISnapshot>): void; - listSnapshots( - request: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, - protos.google.bigtable.admin.v2.ISnapshot>): void; - listSnapshots( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, - protos.google.bigtable.admin.v2.ISnapshot>, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListSnapshotsRequest, - protos.google.bigtable.admin.v2.IListSnapshotsResponse|null|undefined, - protos.google.bigtable.admin.v2.ISnapshot>): - Promise<[ - protos.google.bigtable.admin.v2.ISnapshot[], - protos.google.bigtable.admin.v2.IListSnapshotsRequest|null, - protos.google.bigtable.admin.v2.IListSnapshotsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listSnapshots(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 unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @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 [Snapshot]{@link google.bigtable.admin.v2.Snapshot} 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 `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSnapshotsStream( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSnapshots.createStream( - this.innerApiCalls.listSnapshots as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSnapshots`, 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 unique name of the cluster for which snapshots should be listed. - * Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list snapshots for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {number} request.pageSize - * The maximum number of snapshots to return per page. - * CURRENTLY UNIMPLEMENTED AND IGNORED. - * @param {string} request.pageToken - * The value of `next_page_token` returned by a previous call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Snapshot]{@link google.bigtable.admin.v2.Snapshot}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListSnapshots_async - */ - listSnapshotsAsync( - request?: protos.google.bigtable.admin.v2.IListSnapshotsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSnapshots.asyncIterate( - this.innerApiCalls['listSnapshots'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists Cloud Bigtable backups. Returns both completed and pending - * backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - * @param {number} request.pageSize - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Backup]{@link google.bigtable.admin.v2.Backup}. - * 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.admin.v2.IBackup[], - protos.google.bigtable.admin.v2.IListBackupsRequest|null, - protos.google.bigtable.admin.v2.IListBackupsResponse - ]>; - listBackups( - request: protos.google.bigtable.admin.v2.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, - protos.google.bigtable.admin.v2.IBackup>): void; - listBackups( - request: protos.google.bigtable.admin.v2.IListBackupsRequest, - callback: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, - protos.google.bigtable.admin.v2.IBackup>): void; - listBackups( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, - protos.google.bigtable.admin.v2.IBackup>, - callback?: PaginationCallback< - protos.google.bigtable.admin.v2.IListBackupsRequest, - protos.google.bigtable.admin.v2.IListBackupsResponse|null|undefined, - protos.google.bigtable.admin.v2.IBackup>): - Promise<[ - protos.google.bigtable.admin.v2.IBackup[], - protos.google.bigtable.admin.v2.IListBackupsRequest|null, - protos.google.bigtable.admin.v2.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listBackups(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 cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - * @param {number} request.pageSize - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. - * @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 [Backup]{@link google.bigtable.admin.v2.Backup} 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 `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, 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 cluster to list backups from. Values are of the - * form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * Use `{cluster} = '-'` to list backups for all clusters in an instance, - * e.g., `projects/{project}/instances/{instance}/clusters/-`. - * @param {string} request.filter - * A filter expression that filters backups listed in the response. - * The expression must specify the field name, a comparison operator, - * and the value that you want to use for filtering. The value must be a - * string, a number, or a boolean. The comparison operator must be - * <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is - * roughly synonymous with equality. Filter rules are case insensitive. - * - * The fields eligible for filtering are: - * * `name` - * * `source_table` - * * `state` - * * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. By default, each expression is an AND expression. However, - * you can include AND, OR, and NOT expressions explicitly. - * - * Some examples of using filters are: - * - * * `name:"exact"` --> The backup's name is the string "exact". - * * `name:howl` --> The backup's name contains the string "howl". - * * `source_table:prod` - * --> The source_table's name contains the string "prod". - * * `state:CREATING` --> The backup is pending creation. - * * `state:READY` --> The backup is fully created and ready for use. - * * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")` - * --> The backup name contains the string "howl" and start_time - * of the backup is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` --> The backup's size is greater than 10GB - * @param {string} request.orderBy - * An expression for specifying the sort order of the results of the request. - * The string value should specify one or more fields in {@link google.bigtable.admin.v2.Backup|Backup}. The full - * syntax is described at https://aip.dev/132#ordering. - * - * Fields supported are: - * * name - * * source_table - * * expire_time - * * start_time - * * end_time - * * size_bytes - * * state - * - * For example, "start_time". The default sorting order is ascending. - * To specify descending order for the field, a suffix " desc" should - * be appended to the field name. For example, "start_time desc". - * Redundant space characters in the syntax are insigificant. - * - * If order_by is empty, results will be sorted by `start_time` in descending - * order starting from the most recently created backup. - * @param {number} request.pageSize - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @param {string} request.pageToken - * If non-empty, `page_token` should contain a - * {@link google.bigtable.admin.v2.ListBackupsResponse.next_page_token|next_page_token} from a - * previous {@link google.bigtable.admin.v2.ListBackupsResponse|ListBackupsResponse} to the same `parent` and with the same - * `filter`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.bigtable.admin.v2.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * region_tag:bigtableadmin_v2_generated_BigtableTableAdmin_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.bigtable.admin.v2.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified appProfile resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} app_profile - * @returns {string} Resource name string. - */ - appProfilePath(project:string,instance:string,appProfile:string) { - return this.pathTemplates.appProfilePathTemplate.render({ - project: project, - instance: instance, - app_profile: appProfile, - }); - } - - /** - * Parse the project from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).project; - } - - /** - * Parse the instance from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).instance; - } - - /** - * Parse the app_profile from AppProfile resource. - * - * @param {string} appProfileName - * A fully-qualified path representing AppProfile resource. - * @returns {string} A string representing the app_profile. - */ - matchAppProfileFromAppProfileName(appProfileName: string) { - return this.pathTemplates.appProfilePathTemplate.match(appProfileName).app_profile; - } - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,instance:string,cluster:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the instance from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).instance; - } - - /** - * Parse the cluster from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).cluster; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified cluster resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @returns {string} Resource name string. - */ - clusterPath(project:string,instance:string,cluster:string) { - return this.pathTemplates.clusterPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - }); - } - - /** - * Parse the project from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the project. - */ - matchProjectFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).project; - } - - /** - * Parse the instance from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).instance; - } - - /** - * Parse the cluster from Cluster resource. - * - * @param {string} clusterName - * A fully-qualified path representing Cluster resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; - } - - /** - * Return a fully-qualified hotTablet resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} hot_tablet - * @returns {string} Resource name string. - */ - hotTabletPath(project:string,instance:string,cluster:string,hotTablet:string) { - return this.pathTemplates.hotTabletPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - hot_tablet: hotTablet, - }); - } - - /** - * Parse the project from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).project; - } - - /** - * Parse the instance from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).instance; - } - - /** - * Parse the cluster from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).cluster; - } - - /** - * Parse the hot_tablet from HotTablet resource. - * - * @param {string} hotTabletName - * A fully-qualified path representing HotTablet resource. - * @returns {string} A string representing the hot_tablet. - */ - matchHotTabletFromHotTabletName(hotTabletName: string) { - return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName).hot_tablet; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified snapshot resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} cluster - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project:string,instance:string,cluster:string,snapshot:string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - instance: instance, - cluster: cluster, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the instance from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).instance; - } - - /** - * Parse the cluster from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the cluster. - */ - matchClusterFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).cluster; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * Return a fully-qualified table resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} table - * @returns {string} Resource name string. - */ - tablePath(project:string,instance:string,table:string) { - return this.pathTemplates.tablePathTemplate.render({ - project: project, - instance: instance, - table: table, - }); - } - - /** - * Parse the project from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).project; - } - - /** - * Parse the instance from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).instance; - } - - /** - * Parse the table from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the table. - */ - matchTableFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).table; - } - - /** - * 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.bigtableTableAdminStub && !this._terminated) { - return this.bigtableTableAdminStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json deleted file mode 100644 index b6f59ab62..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client_config.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "interfaces": { - "google.bigtable.admin.v2.BigtableTableAdmin": { - "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 - }, - "264268458a9e88347dbacbd9398202ff5885a40b": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateTable": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTableFromSnapshot": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTables": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "GetTable": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteTable": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ModifyColumnFamilies": { - "timeout_millis": 300000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DropRowRange": { - "timeout_millis": 3600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateConsistencyToken": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "CheckConsistency": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "SnapshotTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "ListSnapshots": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "DeleteSnapshot": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "UpdateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "RestoreTable": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" - } - } - } - } -} diff --git a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json deleted file mode 100644 index 1f7e1af50..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_proto_list.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/bigtable/admin/v2/bigtable_instance_admin.proto", - "../../protos/google/bigtable/admin/v2/bigtable_table_admin.proto", - "../../protos/google/bigtable/admin/v2/common.proto", - "../../protos/google/bigtable/admin/v2/instance.proto", - "../../protos/google/bigtable/admin/v2/table.proto" -] diff --git a/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json b/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 8faad0b19..000000000 --- a/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.bigtable.admin.v2", - "libraryPackage": "@google-cloud/bigtable", - "services": { - "BigtableInstanceAdmin": { - "clients": { - "grpc": { - "libraryClient": "BigtableInstanceAdminClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "CreateAppProfile": { - "methods": [ - "createAppProfile" - ] - }, - "GetAppProfile": { - "methods": [ - "getAppProfile" - ] - }, - "DeleteAppProfile": { - "methods": [ - "deleteAppProfile" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "PartialUpdateInstance": { - "methods": [ - "partialUpdateInstance" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "PartialUpdateCluster": { - "methods": [ - "partialUpdateCluster" - ] - }, - "UpdateAppProfile": { - "methods": [ - "updateAppProfile" - ] - }, - "ListAppProfiles": { - "methods": [ - "listAppProfiles", - "listAppProfilesStream", - "listAppProfilesAsync" - ] - }, - "ListHotTablets": { - "methods": [ - "listHotTablets", - "listHotTabletsStream", - "listHotTabletsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BigtableInstanceAdminClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "ListInstances": { - "methods": [ - "listInstances" - ] - }, - "UpdateInstance": { - "methods": [ - "updateInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - }, - "GetCluster": { - "methods": [ - "getCluster" - ] - }, - "ListClusters": { - "methods": [ - "listClusters" - ] - }, - "DeleteCluster": { - "methods": [ - "deleteCluster" - ] - }, - "CreateAppProfile": { - "methods": [ - "createAppProfile" - ] - }, - "GetAppProfile": { - "methods": [ - "getAppProfile" - ] - }, - "DeleteAppProfile": { - "methods": [ - "deleteAppProfile" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "PartialUpdateInstance": { - "methods": [ - "partialUpdateInstance" - ] - }, - "CreateCluster": { - "methods": [ - "createCluster" - ] - }, - "UpdateCluster": { - "methods": [ - "updateCluster" - ] - }, - "PartialUpdateCluster": { - "methods": [ - "partialUpdateCluster" - ] - }, - "UpdateAppProfile": { - "methods": [ - "updateAppProfile" - ] - }, - "ListAppProfiles": { - "methods": [ - "listAppProfiles", - "listAppProfilesStream", - "listAppProfilesAsync" - ] - }, - "ListHotTablets": { - "methods": [ - "listHotTablets", - "listHotTabletsStream", - "listHotTabletsAsync" - ] - } - } - } - } - }, - "BigtableTableAdmin": { - "clients": { - "grpc": { - "libraryClient": "BigtableTableAdminClient", - "rpcs": { - "CreateTable": { - "methods": [ - "createTable" - ] - }, - "GetTable": { - "methods": [ - "getTable" - ] - }, - "DeleteTable": { - "methods": [ - "deleteTable" - ] - }, - "ModifyColumnFamilies": { - "methods": [ - "modifyColumnFamilies" - ] - }, - "DropRowRange": { - "methods": [ - "dropRowRange" - ] - }, - "GenerateConsistencyToken": { - "methods": [ - "generateConsistencyToken" - ] - }, - "CheckConsistency": { - "methods": [ - "checkConsistency" - ] - }, - "GetSnapshot": { - "methods": [ - "getSnapshot" - ] - }, - "DeleteSnapshot": { - "methods": [ - "deleteSnapshot" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateTableFromSnapshot": { - "methods": [ - "createTableFromSnapshot" - ] - }, - "SnapshotTable": { - "methods": [ - "snapshotTable" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "RestoreTable": { - "methods": [ - "restoreTable" - ] - }, - "ListTables": { - "methods": [ - "listTables", - "listTablesStream", - "listTablesAsync" - ] - }, - "ListSnapshots": { - "methods": [ - "listSnapshots", - "listSnapshotsStream", - "listSnapshotsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BigtableTableAdminClient", - "rpcs": { - "CreateTable": { - "methods": [ - "createTable" - ] - }, - "GetTable": { - "methods": [ - "getTable" - ] - }, - "DeleteTable": { - "methods": [ - "deleteTable" - ] - }, - "ModifyColumnFamilies": { - "methods": [ - "modifyColumnFamilies" - ] - }, - "DropRowRange": { - "methods": [ - "dropRowRange" - ] - }, - "GenerateConsistencyToken": { - "methods": [ - "generateConsistencyToken" - ] - }, - "CheckConsistency": { - "methods": [ - "checkConsistency" - ] - }, - "GetSnapshot": { - "methods": [ - "getSnapshot" - ] - }, - "DeleteSnapshot": { - "methods": [ - "deleteSnapshot" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "CreateTableFromSnapshot": { - "methods": [ - "createTableFromSnapshot" - ] - }, - "SnapshotTable": { - "methods": [ - "snapshotTable" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "RestoreTable": { - "methods": [ - "restoreTable" - ] - }, - "ListTables": { - "methods": [ - "listTables", - "listTablesStream", - "listTablesAsync" - ] - }, - "ListSnapshots": { - "methods": [ - "listSnapshots", - "listSnapshotsStream", - "listSnapshotsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/admin/v2/src/v2/index.ts b/owl-bot-staging/admin/v2/src/v2/index.ts deleted file mode 100644 index 28ff835fe..000000000 --- a/owl-bot-staging/admin/v2/src/v2/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {BigtableInstanceAdminClient} from './bigtable_instance_admin_client'; -export {BigtableTableAdminClient} from './bigtable_table_admin_client'; diff --git a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index a1a5af715..000000000 --- a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const admin = require('@google-cloud/bigtable'); - -function main() { - const bigtableInstanceAdminClient = new admin.BigtableInstanceAdminClient(); - const bigtableTableAdminClient = new admin.BigtableTableAdminClient(); -} - -main(); diff --git a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6224e735f..000000000 --- a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {BigtableInstanceAdminClient, BigtableTableAdminClient} from '@google-cloud/bigtable'; - -// check that the client class type name can be used -function doStuffWithBigtableInstanceAdminClient(client: BigtableInstanceAdminClient) { - client.close(); -} -function doStuffWithBigtableTableAdminClient(client: BigtableTableAdminClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const bigtableInstanceAdminClient = new BigtableInstanceAdminClient(); - doStuffWithBigtableInstanceAdminClient(bigtableInstanceAdminClient); - // check that the client instance can be created - const bigtableTableAdminClient = new BigtableTableAdminClient(); - doStuffWithBigtableTableAdminClient(bigtableTableAdminClient); -} - -main(); diff --git a/owl-bot-staging/admin/v2/system-test/install.ts b/owl-bot-staging/admin/v2/system-test/install.ts deleted file mode 100644 index 8ec452229..000000000 --- a/owl-bot-staging/admin/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts b/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts deleted file mode 100644 index df3fa5037..000000000 --- a/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts +++ /dev/null @@ -1,3152 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as bigtableinstanceadminModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.BigtableInstanceAdminClient', () => { - it('has servicePath', () => { - const servicePath = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = bigtableinstanceadminModule.v2.BigtableInstanceAdminClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableInstanceAdminStub, undefined); - await client.initialize(); - assert(client.bigtableInstanceAdminStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.bigtableInstanceAdminStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableInstanceAdminStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getInstance with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - assert((client.innerApiCalls.getInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetInstanceRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesResponse()); - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListInstancesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listInstances with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - assert((client.innerApiCalls.listInstances as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listInstances with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListInstancesRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listInstances(request), expectedError); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - client.innerApiCalls.updateInstance = stubSimpleCall(expectedResponse); - const [response] = await client.updateInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - client.innerApiCalls.updateInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateInstance with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - assert((client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateInstance with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Instance()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateInstance(request), expectedError); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteInstance = stubSimpleCall(expectedResponse); - const [response] = await client.deleteInstance(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteInstance with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - assert((client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteInstance with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteInstanceRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteInstance(request), expectedError); - }); - }); - - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getCluster with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - assert((client.innerApiCalls.getCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetClusterRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getCluster(request), expectedError); - }); - }); - - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listClusters as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listClusters without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersResponse()); - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IListClustersResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listClusters as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listClusters with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - assert((client.innerApiCalls.listClusters as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listClusters with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListClustersRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listClusters(request), expectedError); - }); - }); - - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteCluster = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCluster(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCluster without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteCluster with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - assert((client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteCluster with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteClusterRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteCluster(request), expectedError); - }); - }); - - describe('createAppProfile', () => { - it('invokes createAppProfile without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); - client.innerApiCalls.createAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.createAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAppProfile without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); - client.innerApiCalls.createAppProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAppProfile( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createAppProfile with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAppProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAppProfile(request), expectedError); - assert((client.innerApiCalls.createAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAppProfile with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateAppProfileRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createAppProfile(request), expectedError); - }); - }); - - describe('getAppProfile', () => { - it('invokes getAppProfile without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); - client.innerApiCalls.getAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAppProfile without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()); - client.innerApiCalls.getAppProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAppProfile( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAppProfile with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAppProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAppProfile(request), expectedError); - assert((client.innerApiCalls.getAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAppProfile with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetAppProfileRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAppProfile(request), expectedError); - }); - }); - - describe('deleteAppProfile', () => { - it('invokes deleteAppProfile without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAppProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAppProfile(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAppProfile without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAppProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAppProfile( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAppProfile with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAppProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAppProfile(request), expectedError); - assert((client.innerApiCalls.deleteAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAppProfile with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteAppProfileRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAppProfile(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createInstance with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateInstanceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('partialUpdateInstance', () => { - it('invokes partialUpdateInstance without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.partialUpdateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes partialUpdateInstance without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.partialUpdateInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes partialUpdateInstance with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.partialUpdateInstance(request), expectedError); - assert((client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes partialUpdateInstance with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateInstanceRequest()); - request.instance = {}; - request.instance.name = ''; - const expectedHeaderRequestParams = "instance.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.partialUpdateInstance(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.partialUpdateInstance as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkPartialUpdateInstanceProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPartialUpdateInstanceProgress with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createCluster with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - assert((client.innerApiCalls.createCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createCluster with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateClusterRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateClusterProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCluster without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateCluster with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - assert((client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateCluster with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.Cluster()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateClusterProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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 bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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('partialUpdateCluster', () => { - it('invokes partialUpdateCluster without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = "cluster.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.partialUpdateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes partialUpdateCluster without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = "cluster.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.partialUpdateCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes partialUpdateCluster with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = "cluster.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.partialUpdateCluster(request), expectedError); - assert((client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes partialUpdateCluster with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.PartialUpdateClusterRequest()); - request.cluster = {}; - request.cluster.name = ''; - const expectedHeaderRequestParams = "cluster.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.partialUpdateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.partialUpdateCluster(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.partialUpdateCluster as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkPartialUpdateClusterProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPartialUpdateClusterProgress with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkPartialUpdateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateAppProfile', () => { - it('invokes updateAppProfile without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = "app_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateAppProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAppProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAppProfile without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = "app_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateAppProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAppProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateAppProfile with call error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = "app_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAppProfile(request), expectedError); - assert((client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateAppProfile with LRO error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateAppProfileRequest()); - request.appProfile = {}; - request.appProfile.name = ''; - const expectedHeaderRequestParams = "app_profile.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAppProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAppProfile(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateAppProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateAppProfileProgress without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateAppProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateAppProfileProgress with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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.checkUpdateAppProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAppProfiles', () => { - it('invokes listAppProfiles without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.innerApiCalls.listAppProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listAppProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAppProfiles without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.innerApiCalls.listAppProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAppProfiles( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IAppProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAppProfiles with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAppProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAppProfiles(request), expectedError); - assert((client.innerApiCalls.listAppProfiles as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAppProfilesStream without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAppProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { - 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.listAppProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listAppProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAppProfilesStream with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAppProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAppProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.AppProfile[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.AppProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAppProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAppProfiles, request)); - assert.strictEqual( - (client.descriptors.page.listAppProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAppProfiles without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - generateSampleMessage(new protos.google.bigtable.admin.v2.AppProfile()), - ]; - client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; - const iterable = client.listAppProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAppProfiles with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListAppProfilesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAppProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAppProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IAppProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAppProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listHotTablets', () => { - it('invokes listHotTablets without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); - const [response] = await client.listHotTablets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHotTablets without error using callback', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.innerApiCalls.listHotTablets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHotTablets( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IHotTablet[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listHotTablets with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listHotTablets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHotTablets(request), expectedError); - assert((client.innerApiCalls.listHotTablets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHotTabletsStream without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHotTabletsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { - 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.listHotTablets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); - assert.strictEqual( - (client.descriptors.page.listHotTablets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listHotTabletsStream with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listHotTablets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHotTabletsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.HotTablet) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHotTablets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHotTablets, request)); - assert.strictEqual( - (client.descriptors.page.listHotTablets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHotTablets without error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), - ]; - client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; - const iterable = client.listHotTabletsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHotTablets with error', async () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListHotTabletsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listHotTablets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHotTabletsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHotTablets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('appProfile', () => { - const fakePath = "/rendered/path/appProfile"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - app_profile: "appProfileValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.appProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.appProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('appProfilePath', () => { - const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAppProfileName', () => { - const result = client.matchProjectFromAppProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromAppProfileName', () => { - const result = client.matchInstanceFromAppProfileName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAppProfileFromAppProfileName', () => { - const result = client.matchAppProfileFromAppProfileName(fakePath); - assert.strictEqual(result, "appProfileValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - backup: "backupValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromBackupName', () => { - const result = client.matchInstanceFromBackupName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromBackupName', () => { - const result = client.matchClusterFromBackupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cluster', () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromClusterName', () => { - const result = client.matchInstanceFromClusterName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('hotTablet', () => { - const fakePath = "/rendered/path/hotTablet"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - hot_tablet: "hotTabletValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hotTabletPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hotTabletPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hotTabletPath', () => { - const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHotTabletName', () => { - const result = client.matchProjectFromHotTabletName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromHotTabletName', () => { - const result = client.matchInstanceFromHotTabletName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromHotTabletName', () => { - const result = client.matchClusterFromHotTabletName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHotTabletFromHotTabletName', () => { - const result = client.matchHotTabletFromHotTabletName(fakePath); - assert.strictEqual(result, "hotTabletValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - 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('snapshot', () => { - const fakePath = "/rendered/path/snapshot"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - snapshot: "snapshotValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.snapshotPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snapshotPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snapshotPath', () => { - const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnapshotName', () => { - const result = client.matchProjectFromSnapshotName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromSnapshotName', () => { - const result = client.matchInstanceFromSnapshotName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSnapshotName', () => { - const result = client.matchClusterFromSnapshotName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnapshotFromSnapshotName', () => { - const result = client.matchSnapshotFromSnapshotName(fakePath); - assert.strictEqual(result, "snapshotValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('table', () => { - const fakePath = "/rendered/path/table"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - table: "tableValue", - }; - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tablePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tablePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tablePath', () => { - const result = client.tablePath("projectValue", "instanceValue", "tableValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tablePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTableName', () => { - const result = client.matchProjectFromTableName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromTableName', () => { - const result = client.matchInstanceFromTableName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTableFromTableName', () => { - const result = client.matchTableFromTableName(fakePath); - assert.strictEqual(result, "tableValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts b/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts deleted file mode 100644 index 03980510e..000000000 --- a/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts +++ /dev/null @@ -1,3243 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as bigtabletableadminModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.BigtableTableAdminClient', () => { - it('has servicePath', () => { - const servicePath = bigtabletableadminModule.v2.BigtableTableAdminClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = bigtabletableadminModule.v2.BigtableTableAdminClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = bigtabletableadminModule.v2.BigtableTableAdminClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableTableAdminStub, undefined); - await client.initialize(); - assert(client.bigtableTableAdminStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.bigtableTableAdminStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableTableAdminStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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 bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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('createTable', () => { - it('invokes createTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.createTable = stubSimpleCall(expectedResponse); - const [response] = await client.createTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.createTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTable( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTable(request), expectedError); - assert((client.innerApiCalls.createTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createTable(request), expectedError); - }); - }); - - describe('getTable', () => { - it('invokes getTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); - const [response] = await client.getTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.getTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTable( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTable(request), expectedError); - assert((client.innerApiCalls.getTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetTableRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTable(request), expectedError); - }); - }); - - describe('deleteTable', () => { - it('invokes deleteTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTable(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTable( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteTable with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTable(request), expectedError); - assert((client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTable with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteTableRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteTable(request), expectedError); - }); - }); - - describe('modifyColumnFamilies', () => { - it('invokes modifyColumnFamilies without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(expectedResponse); - const [response] = await client.modifyColumnFamilies(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes modifyColumnFamilies without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Table()); - client.innerApiCalls.modifyColumnFamilies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.modifyColumnFamilies( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes modifyColumnFamilies with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.modifyColumnFamilies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.modifyColumnFamilies(request), expectedError); - assert((client.innerApiCalls.modifyColumnFamilies as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes modifyColumnFamilies with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ModifyColumnFamiliesRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.modifyColumnFamilies(request), expectedError); - }); - }); - - describe('dropRowRange', () => { - it('invokes dropRowRange without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.dropRowRange = stubSimpleCall(expectedResponse); - const [response] = await client.dropRowRange(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes dropRowRange without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.dropRowRange = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.dropRowRange( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes dropRowRange with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.dropRowRange = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.dropRowRange(request), expectedError); - assert((client.innerApiCalls.dropRowRange as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes dropRowRange with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DropRowRangeRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.dropRowRange(request), expectedError); - }); - }); - - describe('generateConsistencyToken', () => { - it('invokes generateConsistencyToken without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); - client.innerApiCalls.generateConsistencyToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateConsistencyToken(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes generateConsistencyToken without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenResponse()); - client.innerApiCalls.generateConsistencyToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateConsistencyToken( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IGenerateConsistencyTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes generateConsistencyToken with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.generateConsistencyToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateConsistencyToken(request), expectedError); - assert((client.innerApiCalls.generateConsistencyToken as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes generateConsistencyToken with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GenerateConsistencyTokenRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateConsistencyToken(request), expectedError); - }); - }); - - describe('checkConsistency', () => { - it('invokes checkConsistency without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); - client.innerApiCalls.checkConsistency = stubSimpleCall(expectedResponse); - const [response] = await client.checkConsistency(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkConsistency without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyResponse()); - client.innerApiCalls.checkConsistency = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkConsistency( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ICheckConsistencyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes checkConsistency with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.checkConsistency = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkConsistency(request), expectedError); - assert((client.innerApiCalls.checkConsistency as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkConsistency with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CheckConsistencyRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkConsistency(request), expectedError); - }); - }); - - describe('getSnapshot', () => { - it('invokes getSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); - client.innerApiCalls.getSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.getSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()); - client.innerApiCalls.getSnapshot = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSnapshot( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSnapshot with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSnapshot = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSnapshot(request), expectedError); - assert((client.innerApiCalls.getSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSnapshot with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetSnapshotRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSnapshot(request), expectedError); - }); - }); - - describe('deleteSnapshot', () => { - it('invokes deleteSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSnapshot = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSnapshot(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSnapshot = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSnapshot( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSnapshot with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSnapshot = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSnapshot(request), expectedError); - assert((client.innerApiCalls.deleteSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSnapshot with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteSnapshotRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSnapshot(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - assert((client.innerApiCalls.getBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.GetBackupRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()); - client.innerApiCalls.updateBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedHeaderRequestParams = "backup.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - assert((client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.UpdateBackupRequest()); - request.backup = {}; - request.backup.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBackup(request), expectedError); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteBackup with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - assert((client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBackup with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.DeleteBackupRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBackup(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('createTableFromSnapshot', () => { - it('invokes createTableFromSnapshot without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(expectedResponse); - const [operation] = await client.createTableFromSnapshot(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTableFromSnapshot without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTableFromSnapshot( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createTableFromSnapshot with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createTableFromSnapshot(request), expectedError); - assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTableFromSnapshot with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateTableFromSnapshotRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTableFromSnapshot = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createTableFromSnapshot(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createTableFromSnapshot as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateTableFromSnapshotProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateTableFromSnapshotProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateTableFromSnapshotProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateTableFromSnapshotProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('snapshotTable', () => { - it('invokes snapshotTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.snapshotTable = stubLongRunningCall(expectedResponse); - const [operation] = await client.snapshotTable(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes snapshotTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.snapshotTable = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.snapshotTable( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes snapshotTable with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.snapshotTable(request), expectedError); - assert((client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes snapshotTable with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.SnapshotTableRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.snapshotTable = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.snapshotTable(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.snapshotTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkSnapshotTableProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkSnapshotTableProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSnapshotTableProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkSnapshotTableProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBackup with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.CreateBackupRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createBackup as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreTable', () => { - it('invokes restoreTable without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreTable = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreTable(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreTable without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.restoreTable = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreTable( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.restoreTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes restoreTable with call error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreTable(request), expectedError); - assert((client.innerApiCalls.restoreTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes restoreTable with LRO error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.RestoreTableRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreTable = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreTable(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.restoreTable as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRestoreTableProgress without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkRestoreTableProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreTableProgress with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - 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.checkRestoreTableProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listTables', () => { - it('invokes listTables without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); - const [response] = await client.listTables(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTables as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTables without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.innerApiCalls.listTables = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTables( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ITable[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTables as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listTables with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listTables = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTables(request), expectedError); - assert((client.innerApiCalls.listTables as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTablesStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.descriptors.page.listTables.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Table[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { - 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.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert.strictEqual( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listTablesStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Table[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Table) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert.strictEqual( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listTables without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Table()), - ]; - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.ITable[] = []; - const iterable = client.listTablesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listTables with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListTablesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTablesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.ITable[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSnapshots', () => { - it('invokes listSnapshots without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.innerApiCalls.listSnapshots = stubSimpleCall(expectedResponse); - const [response] = await client.listSnapshots(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSnapshots without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.innerApiCalls.listSnapshots = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSnapshots( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.ISnapshot[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSnapshots with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSnapshots = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSnapshots(request), expectedError); - assert((client.innerApiCalls.listSnapshots as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSnapshotsStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSnapshotsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { - 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.listSnapshots.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); - assert.strictEqual( - (client.descriptors.page.listSnapshots.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSnapshotsStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSnapshots.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSnapshotsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Snapshot[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Snapshot) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSnapshots.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSnapshots, request)); - assert.strictEqual( - (client.descriptors.page.listSnapshots.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSnapshots without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Snapshot()), - ]; - client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; - const iterable = client.listSnapshotsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSnapshots with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListSnapshotsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSnapshots.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSnapshotsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.ISnapshot[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.bigtable.admin.v2.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBackups with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - assert((client.innerApiCalls.listBackups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Backup[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { - 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.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.bigtable.admin.v2.Backup[] = []; - stream.on('data', (response: protos.google.bigtable.admin.v2.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert.strictEqual( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - generateSampleMessage(new protos.google.bigtable.admin.v2.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.bigtable.admin.v2.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.admin.v2.ListBackupsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.bigtable.admin.v2.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('appProfile', () => { - const fakePath = "/rendered/path/appProfile"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - app_profile: "appProfileValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.appProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.appProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('appProfilePath', () => { - const result = client.appProfilePath("projectValue", "instanceValue", "appProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.appProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAppProfileName', () => { - const result = client.matchProjectFromAppProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromAppProfileName', () => { - const result = client.matchInstanceFromAppProfileName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAppProfileFromAppProfileName', () => { - const result = client.matchAppProfileFromAppProfileName(fakePath); - assert.strictEqual(result, "appProfileValue"); - assert((client.pathTemplates.appProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - backup: "backupValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "instanceValue", "clusterValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromBackupName', () => { - const result = client.matchInstanceFromBackupName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromBackupName', () => { - const result = client.matchClusterFromBackupName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cluster', () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "instanceValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromClusterName', () => { - const result = client.matchInstanceFromClusterName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('hotTablet', () => { - const fakePath = "/rendered/path/hotTablet"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - hot_tablet: "hotTabletValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hotTabletPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hotTabletPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hotTabletPath', () => { - const result = client.hotTabletPath("projectValue", "instanceValue", "clusterValue", "hotTabletValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hotTabletPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHotTabletName', () => { - const result = client.matchProjectFromHotTabletName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromHotTabletName', () => { - const result = client.matchInstanceFromHotTabletName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromHotTabletName', () => { - const result = client.matchClusterFromHotTabletName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHotTabletFromHotTabletName', () => { - const result = client.matchHotTabletFromHotTabletName(fakePath); - assert.strictEqual(result, "hotTabletValue"); - assert((client.pathTemplates.hotTabletPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('snapshot', () => { - const fakePath = "/rendered/path/snapshot"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - cluster: "clusterValue", - snapshot: "snapshotValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.snapshotPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snapshotPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snapshotPath', () => { - const result = client.snapshotPath("projectValue", "instanceValue", "clusterValue", "snapshotValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snapshotPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnapshotName', () => { - const result = client.matchProjectFromSnapshotName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromSnapshotName', () => { - const result = client.matchInstanceFromSnapshotName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSnapshotName', () => { - const result = client.matchClusterFromSnapshotName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnapshotFromSnapshotName', () => { - const result = client.matchSnapshotFromSnapshotName(fakePath); - assert.strictEqual(result, "snapshotValue"); - assert((client.pathTemplates.snapshotPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('table', () => { - const fakePath = "/rendered/path/table"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - table: "tableValue", - }; - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tablePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tablePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tablePath', () => { - const result = client.tablePath("projectValue", "instanceValue", "tableValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tablePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTableName', () => { - const result = client.matchProjectFromTableName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromTableName', () => { - const result = client.matchInstanceFromTableName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTableFromTableName', () => { - const result = client.matchTableFromTableName(fakePath); - assert.strictEqual(result, "tableValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/admin/v2/tsconfig.json b/owl-bot-staging/admin/v2/tsconfig.json deleted file mode 100644 index c78f1c884..000000000 --- a/owl-bot-staging/admin/v2/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/admin/v2/webpack.config.js b/owl-bot-staging/admin/v2/webpack.config.js deleted file mode 100644 index 9b488aad8..000000000 --- a/owl-bot-staging/admin/v2/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'bigtable', - filename: './bigtable.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v2/.eslintignore b/owl-bot-staging/v2/.eslintignore deleted file mode 100644 index cfc348ec4..000000000 --- a/owl-bot-staging/v2/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v2/.eslintrc.json b/owl-bot-staging/v2/.eslintrc.json deleted file mode 100644 index 782153495..000000000 --- a/owl-bot-staging/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v2/.gitignore b/owl-bot-staging/v2/.gitignore deleted file mode 100644 index 5d32b2378..000000000 --- a/owl-bot-staging/v2/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v2/.jsdoc.js b/owl-bot-staging/v2/.jsdoc.js deleted file mode 100644 index 7cb0f52a2..000000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/bigtable', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v2/.mocharc.js b/owl-bot-staging/v2/.mocharc.js deleted file mode 100644 index 481c522b0..000000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v2/.prettierrc.js b/owl-bot-staging/v2/.prettierrc.js deleted file mode 100644 index 494e14786..000000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v2/README.md b/owl-bot-staging/v2/README.md deleted file mode 100644 index c464f1223..000000000 --- a/owl-bot-staging/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Bigtable: Nodejs Client diff --git a/owl-bot-staging/v2/linkinator.config.json b/owl-bot-staging/v2/linkinator.config.json deleted file mode 100644 index befd23c86..000000000 --- a/owl-bot-staging/v2/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index be457bb5e..000000000 --- a/owl-bot-staging/v2/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/bigtable", - "version": "0.1.0", - "description": "Bigtable client for Node.js", - "repository": "googleapis/nodejs-bigtable", - "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 bigtable", - "bigtable", - "bigtable" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto b/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto deleted file mode 100644 index 215b573cb..000000000 --- a/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto +++ /dev/null @@ -1,528 +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.bigtable.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/api/routing.proto"; -import "google/bigtable/v2/data.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Bigtable.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; -option java_multiple_files = true; -option java_outer_classname = "BigtableProto"; -option java_package = "com.google.bigtable.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\V2"; -option ruby_package = "Google::Cloud::Bigtable::V2"; -option (google.api.resource_definition) = { - type: "bigtableadmin.googleapis.com/Table" - pattern: "projects/{project}/instances/{instance}/tables/{table}" -}; -option (google.api.resource_definition) = { - type: "bigtableadmin.googleapis.com/Instance" - pattern: "projects/{project}/instances/{instance}" -}; - -// Service for reading from and writing to existing Bigtable tables. -service Bigtable { - option (google.api.default_host) = "bigtable.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigtable.data," - "https://www.googleapis.com/auth/bigtable.data.readonly," - "https://www.googleapis.com/auth/cloud-bigtable.data," - "https://www.googleapis.com/auth/cloud-bigtable.data.readonly," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Streams back the contents of all requested rows in key order, optionally - // applying the same Reader filter to each. Depending on their size, - // rows and cells may be broken up across multiple responses, but - // atomicity of each row will still be preserved. See the - // ReadRowsResponse documentation for details. - rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { - option (google.api.http) = { - post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name"; - option (google.api.method_signature) = "table_name,app_profile_id"; - } - - // Returns a sample of row keys in the table. The returned row keys will - // delimit contiguous sections of the table of approximately equal size, - // which can be used to break up the data for distributed tasks like - // mapreduces. - rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) { - option (google.api.http) = { - get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name"; - option (google.api.method_signature) = "table_name,app_profile_id"; - } - - // Mutates a row atomically. Cells already present in the row are left - // unchanged unless explicitly changed by `mutation`. - rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) { - option (google.api.http) = { - post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name,row_key,mutations"; - option (google.api.method_signature) = "table_name,row_key,mutations,app_profile_id"; - } - - // Mutates multiple rows in a batch. Each individual row is mutated - // atomically as in MutateRow, but the entire batch is not executed - // atomically. - rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) { - option (google.api.http) = { - post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name,entries"; - option (google.api.method_signature) = "table_name,entries,app_profile_id"; - } - - // Mutates a row atomically based on the output of a predicate Reader filter. - rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) { - option (google.api.http) = { - post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations"; - option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations,app_profile_id"; - } - - // Warm up associated instance metadata for this connection. - // This call is not required but may be useful for connection keep-alive. - rpc PingAndWarm(PingAndWarmRequest) returns (PingAndWarmResponse) { - option (google.api.http) = { - post: "/v2/{name=projects/*/instances/*}:ping" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "name" - path_template: "{name=projects/*/instances/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "name"; - option (google.api.method_signature) = "name,app_profile_id"; - } - - // Modifies a row atomically on the server. The method reads the latest - // existing timestamp and value from the specified columns and writes a new - // entry based on pre-defined read/modify/write rules. The new value for the - // timestamp is the greater of the existing timestamp or the current server - // time. The method returns the new contents of all modified cells. - rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (ReadModifyWriteRowResponse) { - option (google.api.http) = { - post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow" - body: "*" - }; - option (google.api.routing) = { - routing_parameters { - field: "table_name" - path_template: "{table_name=projects/*/instances/*/tables/*}" - } - routing_parameters { - field: "app_profile_id" - } - }; - option (google.api.method_signature) = "table_name,row_key,rules"; - option (google.api.method_signature) = "table_name,row_key,rules,app_profile_id"; - } -} - -// Request message for Bigtable.ReadRows. -message ReadRowsRequest { - // Required. The unique name of the table from which to read. - // Values are of the form - // `projects//instances//tables/
include:samples/generated/v2/bigtable_instance_admin.get_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.list_instances.jsinclude:samples/generated/v2/bigtable_instance_admin.update_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.delete_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.get_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.list_clusters.jsinclude:samples/generated/v2/bigtable_instance_admin.delete_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.create_app_profile.jsinclude:samples/generated/v2/bigtable_instance_admin.get_app_profile.jsinclude:samples/generated/v2/bigtable_instance_admin.delete_app_profile.jsinclude:samples/generated/v2/bigtable_instance_admin.get_iam_policy.jsinclude:samples/generated/v2/bigtable_instance_admin.set_iam_policy.jsinclude:samples/generated/v2/bigtable_instance_admin.test_iam_permissions.jsinclude:samples/generated/v2/bigtable_instance_admin.create_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.create_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.partial_update_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.partial_update_instance.jsinclude:samples/generated/v2/bigtable_instance_admin.create_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.create_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.update_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.update_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.partial_update_cluster.jsinclude:samples/generated/v2/bigtable_instance_admin.update_app_profile.jsinclude:samples/generated/v2/bigtable_instance_admin.update_app_profile.jsinclude:samples/generated/v2/bigtable_instance_admin.list_app_profiles.jsinclude:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.jsinclude:samples/generated/v2/bigtable_table_admin.create_table.jsinclude:samples/generated/v2/bigtable_table_admin.get_table.jsinclude:samples/generated/v2/bigtable_table_admin.delete_table.jsinclude:samples/generated/v2/bigtable_table_admin.modify_column_families.jsinclude:samples/generated/v2/bigtable_table_admin.drop_row_range.jsinclude:samples/generated/v2/bigtable_table_admin.generate_consistency_token.jsinclude:samples/generated/v2/bigtable_table_admin.check_consistency.jsinclude:samples/generated/v2/bigtable_table_admin.get_snapshot.jsinclude:samples/generated/v2/bigtable_table_admin.delete_snapshot.jsinclude:samples/generated/v2/bigtable_table_admin.get_backup.jsinclude:samples/generated/v2/bigtable_table_admin.update_backup.jsinclude:samples/generated/v2/bigtable_table_admin.delete_backup.jsinclude:samples/generated/v2/bigtable_table_admin.get_iam_policy.jsinclude:samples/generated/v2/bigtable_table_admin.set_iam_policy.jsinclude:samples/generated/v2/bigtable_table_admin.test_iam_permissions.jsinclude:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.jsinclude:samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.jsinclude:samples/generated/v2/bigtable_table_admin.snapshot_table.jsinclude:samples/generated/v2/bigtable_table_admin.snapshot_table.jsinclude:samples/generated/v2/bigtable_table_admin.create_backup.jsinclude:samples/generated/v2/bigtable_table_admin.create_backup.jsinclude:samples/generated/v2/bigtable_table_admin.restore_table.jsinclude:samples/generated/v2/bigtable_table_admin.restore_table.jsinclude:samples/generated/v2/bigtable_table_admin.list_tables.jsinclude:samples/generated/v2/bigtable_table_admin.list_snapshots.jsinclude:samples/generated/v2/bigtable_table_admin.list_backups.js
`. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 5; - - // The row keys and/or ranges to read sequentially. If not specified, reads - // from all rows. - RowSet rows = 2; - - // The filter to apply to the contents of the specified row(s). If unset, - // reads the entirety of each row. - RowFilter filter = 3; - - // The read will stop after committing to N rows' worth of results. The - // default (zero) is to return all results. - int64 rows_limit = 4; -} - -// Response message for Bigtable.ReadRows. -message ReadRowsResponse { - // Specifies a piece of a row's contents returned as part of the read - // response stream. - message CellChunk { - // The row key for this chunk of data. If the row key is empty, - // this CellChunk is a continuation of the same row as the previous - // CellChunk in the response stream, even if that CellChunk was in a - // previous ReadRowsResponse message. - bytes row_key = 1; - - // The column family name for this chunk of data. If this message - // is not present this CellChunk is a continuation of the same column - // family as the previous CellChunk. The empty string can occur as a - // column family name in a response so clients must check - // explicitly for the presence of this message, not just for - // `family_name.value` being non-empty. - google.protobuf.StringValue family_name = 2; - - // The column qualifier for this chunk of data. If this message - // is not present, this CellChunk is a continuation of the same column - // as the previous CellChunk. Column qualifiers may be empty so - // clients must check for the presence of this message, not just - // for `qualifier.value` being non-empty. - google.protobuf.BytesValue qualifier = 3; - - // The cell's stored timestamp, which also uniquely identifies it - // within its column. Values are always expressed in - // microseconds, but individual tables may set a coarser - // granularity to further restrict the allowed values. For - // example, a table which specifies millisecond granularity will - // only allow values of `timestamp_micros` which are multiples of - // 1000. Timestamps are only set in the first CellChunk per cell - // (for cells split into multiple chunks). - int64 timestamp_micros = 4; - - // Labels applied to the cell by a - // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set - // on the first CellChunk per cell. - repeated string labels = 5; - - // The value stored in the cell. Cell values can be split across - // multiple CellChunks. In that case only the value field will be - // set in CellChunks after the first: the timestamp and labels - // will only be present in the first CellChunk, even if the first - // CellChunk came in a previous ReadRowsResponse. - bytes value = 6; - - // If this CellChunk is part of a chunked cell value and this is - // not the final chunk of that cell, value_size will be set to the - // total length of the cell value. The client can use this size - // to pre-allocate memory to hold the full cell value. - int32 value_size = 7; - - // Signals to the client concerning previous CellChunks received. - oneof row_status { - // Indicates that the client should drop all previous chunks for - // `row_key`, as it will be re-read from the beginning. - bool reset_row = 8; - - // Indicates that the client can safely process all previous chunks for - // `row_key`, as its data has been fully read. - bool commit_row = 9; - } - } - - // A collection of a row's contents as part of the read request. - repeated CellChunk chunks = 1; - - // Optionally the server might return the row key of the last row it - // has scanned. The client can use this to construct a more - // efficient retry request if needed: any row keys or portions of - // ranges less than this row key can be dropped from the request. - // This is primarily useful for cases where the server has read a - // lot of data that was filtered out since the last committed row - // key, allowing the client to skip that work on a retry. - bytes last_scanned_row_key = 2; -} - -// Request message for Bigtable.SampleRowKeys. -message SampleRowKeysRequest { - // Required. The unique name of the table from which to sample row keys. - // Values are of the form - // `projects//instances//tables/
`. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 2; -} - -// Response message for Bigtable.SampleRowKeys. -message SampleRowKeysResponse { - // Sorted streamed sequence of sample row keys in the table. The table might - // have contents before the first row key in the list and after the last one, - // but a key containing the empty string indicates "end of table" and will be - // the last response given, if present. - // Note that row keys in this list may not have ever been written to or read - // from, and users should therefore not make any assumptions about the row key - // structure that are specific to their use case. - bytes row_key = 1; - - // Approximate total storage space used by all rows in the table which precede - // `row_key`. Buffering the contents of all rows between two subsequent - // samples would require space roughly equal to the difference in their - // `offset_bytes` fields. - int64 offset_bytes = 2; -} - -// Request message for Bigtable.MutateRow. -message MutateRowRequest { - // Required. The unique name of the table to which the mutation should be applied. - // Values are of the form - // `projects//instances//tables/
`. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 4; - - // Required. The key of the row to which the mutation should be applied. - bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Changes to be atomically applied to the specified row. Entries are applied - // in order, meaning that earlier mutations can be masked by later ones. - // Must contain at least one entry and at most 100000. - repeated Mutation mutations = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for Bigtable.MutateRow. -message MutateRowResponse { - -} - -// Request message for BigtableService.MutateRows. -message MutateRowsRequest { - // A mutation for a given row. - message Entry { - // The key of the row to which the `mutations` should be applied. - bytes row_key = 1; - - // Required. Changes to be atomically applied to the specified row. Mutations are - // applied in order, meaning that earlier mutations can be masked by - // later ones. - // You must specify at least one mutation. - repeated Mutation mutations = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The unique name of the table to which the mutations should be applied. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 3; - - // Required. The row keys and corresponding mutations to be applied in bulk. - // Each entry is applied as an atomic mutation, but the entries may be - // applied in arbitrary order (even between entries for the same row). - // At least one entry must be specified, and in total the entries can - // contain at most 100000 mutations. - repeated Entry entries = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for BigtableService.MutateRows. -message MutateRowsResponse { - // The result of applying a passed mutation in the original request. - message Entry { - // The index into the original request's `entries` list of the Entry - // for which a result is being reported. - int64 index = 1; - - // The result of the request Entry identified by `index`. - // Depending on how requests are batched during execution, it is possible - // for one Entry to fail due to an error with another Entry. In the event - // that this occurs, the same error will be reported for both entries. - google.rpc.Status status = 2; - } - - // One or more results for Entries from the batch request. - repeated Entry entries = 1; -} - -// Request message for Bigtable.CheckAndMutateRow. -message CheckAndMutateRowRequest { - // Required. The unique name of the table to which the conditional mutation should be - // applied. - // Values are of the form - // `projects//instances//tables/
`. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 7; - - // Required. The key of the row to which the conditional mutation should be applied. - bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // The filter to be applied to the contents of the specified row. Depending - // on whether or not any results are yielded, either `true_mutations` or - // `false_mutations` will be executed. If unset, checks that the row contains - // any values at all. - RowFilter predicate_filter = 6; - - // Changes to be atomically applied to the specified row if `predicate_filter` - // yields at least one cell when applied to `row_key`. Entries are applied in - // order, meaning that earlier mutations can be masked by later ones. - // Must contain at least one entry if `false_mutations` is empty, and at most - // 100000. - repeated Mutation true_mutations = 4; - - // Changes to be atomically applied to the specified row if `predicate_filter` - // does not yield any cells when applied to `row_key`. Entries are applied in - // order, meaning that earlier mutations can be masked by later ones. - // Must contain at least one entry if `true_mutations` is empty, and at most - // 100000. - repeated Mutation false_mutations = 5; -} - -// Response message for Bigtable.CheckAndMutateRow. -message CheckAndMutateRowResponse { - // Whether or not the request's `predicate_filter` yielded any results for - // the specified row. - bool predicate_matched = 1; -} - -// Request message for client connection keep-alive and warming. -message PingAndWarmRequest { - // Required. The unique name of the instance to check permissions for as well as - // respond. Values are of the form `projects//instances/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Instance" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 2; -} - -// Response message for Bigtable.PingAndWarm connection keepalive and warming. -message PingAndWarmResponse { - -} - -// Request message for Bigtable.ReadModifyWriteRow. -message ReadModifyWriteRowRequest { - // Required. The unique name of the table to which the read/modify/write rules should be - // applied. - // Values are of the form - // `projects//instances//tables/
`. - string table_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigtableadmin.googleapis.com/Table" - } - ]; - - // This value specifies routing for replication. If not specified, the - // "default" application profile will be used. - string app_profile_id = 4; - - // Required. The key of the row to which the read/modify/write rules should be applied. - bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Rules specifying how the specified row's contents are to be transformed - // into writes. Entries are applied in order, meaning that earlier rules will - // affect the results of later ones. - repeated ReadModifyWriteRule rules = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for Bigtable.ReadModifyWriteRow. -message ReadModifyWriteRowResponse { - // A Row containing the new contents of all cells modified by the request. - Row row = 1; -} diff --git a/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto b/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto deleted file mode 100644 index 9e5a05c2e..000000000 --- a/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto +++ /dev/null @@ -1,535 +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.bigtable.v2; - -option csharp_namespace = "Google.Cloud.Bigtable.V2"; -option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; -option java_multiple_files = true; -option java_outer_classname = "DataProto"; -option java_package = "com.google.bigtable.v2"; -option php_namespace = "Google\\Cloud\\Bigtable\\V2"; -option ruby_package = "Google::Cloud::Bigtable::V2"; - -// Specifies the complete (requested) contents of a single row of a table. -// Rows which exceed 256MiB in size cannot be read in full. -message Row { - // The unique key which identifies this row within its table. This is the same - // key that's used to identify the row in, for example, a MutateRowRequest. - // May contain any non-empty byte string up to 4KiB in length. - bytes key = 1; - - // May be empty, but only if the entire row is empty. - // The mutual ordering of column families is not specified. - repeated Family families = 2; -} - -// Specifies (some of) the contents of a single row/column family intersection -// of a table. -message Family { - // The unique key which identifies this family within its row. This is the - // same key that's used to identify the family in, for example, a RowFilter - // which sets its "family_name_regex_filter" field. - // Must match `[-_.a-zA-Z0-9]+`, except that AggregatingRowProcessors may - // produce cells in a sentinel family with an empty name. - // Must be no greater than 64 characters in length. - string name = 1; - - // Must not be empty. Sorted in order of increasing "qualifier". - repeated Column columns = 2; -} - -// Specifies (some of) the contents of a single row/column intersection of a -// table. -message Column { - // The unique key which identifies this column within its family. This is the - // same key that's used to identify the column in, for example, a RowFilter - // which sets its `column_qualifier_regex_filter` field. - // May contain any byte string, including the empty string, up to 16kiB in - // length. - bytes qualifier = 1; - - // Must not be empty. Sorted in order of decreasing "timestamp_micros". - repeated Cell cells = 2; -} - -// Specifies (some of) the contents of a single row/column/timestamp of a table. -message Cell { - // The cell's stored timestamp, which also uniquely identifies it within - // its column. - // Values are always expressed in microseconds, but individual tables may set - // a coarser granularity to further restrict the allowed values. For - // example, a table which specifies millisecond granularity will only allow - // values of `timestamp_micros` which are multiples of 1000. - int64 timestamp_micros = 1; - - // The value stored in the cell. - // May contain any byte string, including the empty string, up to 100MiB in - // length. - bytes value = 2; - - // Labels applied to the cell by a [RowFilter][google.bigtable.v2.RowFilter]. - repeated string labels = 3; -} - -// Specifies a contiguous range of rows. -message RowRange { - // The row key at which to start the range. - // If neither field is set, interpreted as the empty string, inclusive. - oneof start_key { - // Used when giving an inclusive lower bound for the range. - bytes start_key_closed = 1; - - // Used when giving an exclusive lower bound for the range. - bytes start_key_open = 2; - } - - // The row key at which to end the range. - // If neither field is set, interpreted as the infinite row key, exclusive. - oneof end_key { - // Used when giving an exclusive upper bound for the range. - bytes end_key_open = 3; - - // Used when giving an inclusive upper bound for the range. - bytes end_key_closed = 4; - } -} - -// Specifies a non-contiguous set of rows. -message RowSet { - // Single rows included in the set. - repeated bytes row_keys = 1; - - // Contiguous row ranges included in the set. - repeated RowRange row_ranges = 2; -} - -// Specifies a contiguous range of columns within a single column family. -// The range spans from <column_family>:<start_qualifier> to -// <column_family>:<end_qualifier>, where both bounds can be either -// inclusive or exclusive. -message ColumnRange { - // The name of the column family within which this range falls. - string family_name = 1; - - // The column qualifier at which to start the range (within `column_family`). - // If neither field is set, interpreted as the empty string, inclusive. - oneof start_qualifier { - // Used when giving an inclusive lower bound for the range. - bytes start_qualifier_closed = 2; - - // Used when giving an exclusive lower bound for the range. - bytes start_qualifier_open = 3; - } - - // The column qualifier at which to end the range (within `column_family`). - // If neither field is set, interpreted as the infinite string, exclusive. - oneof end_qualifier { - // Used when giving an inclusive upper bound for the range. - bytes end_qualifier_closed = 4; - - // Used when giving an exclusive upper bound for the range. - bytes end_qualifier_open = 5; - } -} - -// Specified a contiguous range of microsecond timestamps. -message TimestampRange { - // Inclusive lower bound. If left empty, interpreted as 0. - int64 start_timestamp_micros = 1; - - // Exclusive upper bound. If left empty, interpreted as infinity. - int64 end_timestamp_micros = 2; -} - -// Specifies a contiguous range of raw byte values. -message ValueRange { - // The value at which to start the range. - // If neither field is set, interpreted as the empty string, inclusive. - oneof start_value { - // Used when giving an inclusive lower bound for the range. - bytes start_value_closed = 1; - - // Used when giving an exclusive lower bound for the range. - bytes start_value_open = 2; - } - - // The value at which to end the range. - // If neither field is set, interpreted as the infinite string, exclusive. - oneof end_value { - // Used when giving an inclusive upper bound for the range. - bytes end_value_closed = 3; - - // Used when giving an exclusive upper bound for the range. - bytes end_value_open = 4; - } -} - -// Takes a row as input and produces an alternate view of the row based on -// specified rules. For example, a RowFilter might trim down a row to include -// just the cells from columns matching a given regular expression, or might -// return all the cells of a row but not their values. More complicated filters -// can be composed out of these components to express requests such as, "within -// every column of a particular family, give just the two most recent cells -// which are older than timestamp X." -// -// There are two broad categories of RowFilters (true filters and transformers), -// as well as two ways to compose simple filters into more complex ones -// (chains and interleaves). They work as follows: -// -// * True filters alter the input row by excluding some of its cells wholesale -// from the output row. An example of a true filter is the `value_regex_filter`, -// which excludes cells whose values don't match the specified pattern. All -// regex true filters use RE2 syntax (https://github.com/google/re2/wiki/Syntax) -// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An -// important point to keep in mind is that `RE2(.)` is equivalent by default to -// `RE2([^\n])`, meaning that it does not match newlines. When attempting to -// match an arbitrary byte, you should therefore use the escape sequence `\C`, -// which may need to be further escaped as `\\C` in your client language. -// -// * Transformers alter the input row by changing the values of some of its -// cells in the output, without excluding them completely. Currently, the only -// supported transformer is the `strip_value_transformer`, which replaces every -// cell's value with the empty string. -// -// * Chains and interleaves are described in more detail in the -// RowFilter.Chain and RowFilter.Interleave documentation. -// -// The total serialized size of a RowFilter message must not -// exceed 20480 bytes, and RowFilters may not be nested within each other -// (in Chains or Interleaves) to a depth of more than 20. -message RowFilter { - // A RowFilter which sends rows through several RowFilters in sequence. - message Chain { - // The elements of "filters" are chained together to process the input row: - // in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row - // The full chain is executed atomically. - repeated RowFilter filters = 1; - } - - // A RowFilter which sends each row to each of several component - // RowFilters and interleaves the results. - message Interleave { - // The elements of "filters" all process a copy of the input row, and the - // results are pooled, sorted, and combined into a single output row. - // If multiple cells are produced with the same column and timestamp, - // they will all appear in the output row in an unspecified mutual order. - // Consider the following example, with three filters: - // - // input row - // | - // ----------------------------------------------------- - // | | | - // f(0) f(1) f(2) - // | | | - // 1: foo,bar,10,x foo,bar,10,z far,bar,7,a - // 2: foo,blah,11,z far,blah,5,x far,blah,5,x - // | | | - // ----------------------------------------------------- - // | - // 1: foo,bar,10,z // could have switched with #2 - // 2: foo,bar,10,x // could have switched with #1 - // 3: foo,blah,11,z - // 4: far,bar,7,a - // 5: far,blah,5,x // identical to #6 - // 6: far,blah,5,x // identical to #5 - // - // All interleaved filters are executed atomically. - repeated RowFilter filters = 1; - } - - // A RowFilter which evaluates one of two possible RowFilters, depending on - // whether or not a predicate RowFilter outputs any cells from the input row. - // - // IMPORTANT NOTE: The predicate filter does not execute atomically with the - // true and false filters, which may lead to inconsistent or unexpected - // results. Additionally, Condition filters have poor performance, especially - // when filters are set for the false condition. - message Condition { - // If `predicate_filter` outputs any cells, then `true_filter` will be - // evaluated on the input row. Otherwise, `false_filter` will be evaluated. - RowFilter predicate_filter = 1; - - // The filter to apply to the input row if `predicate_filter` returns any - // results. If not provided, no results will be returned in the true case. - RowFilter true_filter = 2; - - // The filter to apply to the input row if `predicate_filter` does not - // return any results. If not provided, no results will be returned in the - // false case. - RowFilter false_filter = 3; - } - - // Which of the possible RowFilter types to apply. If none are set, this - // RowFilter returns all cells in the input row. - oneof filter { - // Applies several RowFilters to the data in sequence, progressively - // narrowing the results. - Chain chain = 1; - - // Applies several RowFilters to the data in parallel and combines the - // results. - Interleave interleave = 2; - - // Applies one of two possible RowFilters to the data based on the output of - // a predicate RowFilter. - Condition condition = 3; - - // ADVANCED USE ONLY. - // Hook for introspection into the RowFilter. Outputs all cells directly to - // the output of the read rather than to any parent filter. Consider the - // following example: - // - // Chain( - // FamilyRegex("A"), - // Interleave( - // All(), - // Chain(Label("foo"), Sink()) - // ), - // QualifierRegex("B") - // ) - // - // A,A,1,w - // A,B,2,x - // B,B,4,z - // | - // FamilyRegex("A") - // | - // A,A,1,w - // A,B,2,x - // | - // +------------+-------------+ - // | | - // All() Label(foo) - // | | - // A,A,1,w A,A,1,w,labels:[foo] - // A,B,2,x A,B,2,x,labels:[foo] - // | | - // | Sink() --------------+ - // | | | - // +------------+ x------+ A,A,1,w,labels:[foo] - // | A,B,2,x,labels:[foo] - // A,A,1,w | - // A,B,2,x | - // | | - // QualifierRegex("B") | - // | | - // A,B,2,x | - // | | - // +--------------------------------+ - // | - // A,A,1,w,labels:[foo] - // A,B,2,x,labels:[foo] // could be switched - // A,B,2,x // could be switched - // - // Despite being excluded by the qualifier filter, a copy of every cell - // that reaches the sink is present in the final result. - // - // As with an [Interleave][google.bigtable.v2.RowFilter.Interleave], - // duplicate cells are possible, and appear in an unspecified mutual order. - // In this case we have a duplicate with column "A:B" and timestamp 2, - // because one copy passed through the all filter while the other was - // passed through the label and sink. Note that one copy has label "foo", - // while the other does not. - // - // Cannot be used within the `predicate_filter`, `true_filter`, or - // `false_filter` of a [Condition][google.bigtable.v2.RowFilter.Condition]. - bool sink = 16; - - // Matches all cells, regardless of input. Functionally equivalent to - // leaving `filter` unset, but included for completeness. - bool pass_all_filter = 17; - - // Does not match any cells, regardless of input. Useful for temporarily - // disabling just part of a filter. - bool block_all_filter = 18; - - // Matches only cells from rows whose keys satisfy the given RE2 regex. In - // other words, passes through the entire row when the key matches, and - // otherwise produces an empty row. - // Note that, since row keys can contain arbitrary bytes, the `\C` escape - // sequence must be used if a true wildcard is desired. The `.` character - // will not match the new line character `\n`, which may be present in a - // binary key. - bytes row_key_regex_filter = 4; - - // Matches all cells from a row with probability p, and matches no cells - // from the row with probability 1-p. - double row_sample_filter = 14; - - // Matches only cells from columns whose families satisfy the given RE2 - // regex. For technical reasons, the regex must not contain the `:` - // character, even if it is not being used as a literal. - // Note that, since column families cannot contain the new line character - // `\n`, it is sufficient to use `.` as a full wildcard when matching - // column family names. - string family_name_regex_filter = 5; - - // Matches only cells from columns whose qualifiers satisfy the given RE2 - // regex. - // Note that, since column qualifiers can contain arbitrary bytes, the `\C` - // escape sequence must be used if a true wildcard is desired. The `.` - // character will not match the new line character `\n`, which may be - // present in a binary qualifier. - bytes column_qualifier_regex_filter = 6; - - // Matches only cells from columns within the given range. - ColumnRange column_range_filter = 7; - - // Matches only cells with timestamps within the given range. - TimestampRange timestamp_range_filter = 8; - - // Matches only cells with values that satisfy the given regular expression. - // Note that, since cell values can contain arbitrary bytes, the `\C` escape - // sequence must be used if a true wildcard is desired. The `.` character - // will not match the new line character `\n`, which may be present in a - // binary value. - bytes value_regex_filter = 9; - - // Matches only cells with values that fall within the given range. - ValueRange value_range_filter = 15; - - // Skips the first N cells of each row, matching all subsequent cells. - // If duplicate cells are present, as is possible when using an Interleave, - // each copy of the cell is counted separately. - int32 cells_per_row_offset_filter = 10; - - // Matches only the first N cells of each row. - // If duplicate cells are present, as is possible when using an Interleave, - // each copy of the cell is counted separately. - int32 cells_per_row_limit_filter = 11; - - // Matches only the most recent N cells within each column. For example, - // if N=2, this filter would match column `foo:bar` at timestamps 10 and 9, - // skip all earlier cells in `foo:bar`, and then begin matching again in - // column `foo:bar2`. - // If duplicate cells are present, as is possible when using an Interleave, - // each copy of the cell is counted separately. - int32 cells_per_column_limit_filter = 12; - - // Replaces each cell's value with the empty string. - bool strip_value_transformer = 13; - - // Applies the given label to all cells in the output row. This allows - // the client to determine which results were produced from which part of - // the filter. - // - // Values must be at most 15 characters in length, and match the RE2 - // pattern `[a-z0-9\\-]+` - // - // Due to a technical limitation, it is not currently possible to apply - // multiple labels to a cell. As a result, a Chain may have no more than - // one sub-filter which contains a `apply_label_transformer`. It is okay for - // an Interleave to contain multiple `apply_label_transformers`, as they - // will be applied to separate copies of the input. This may be relaxed in - // the future. - string apply_label_transformer = 19; - } -} - -// Specifies a particular change to be made to the contents of a row. -message Mutation { - // A Mutation which sets the value of the specified cell. - message SetCell { - // The name of the family into which new data should be written. - // Must match `[-_.a-zA-Z0-9]+` - string family_name = 1; - - // The qualifier of the column into which new data should be written. - // Can be any byte string, including the empty string. - bytes column_qualifier = 2; - - // The timestamp of the cell into which new data should be written. - // Use -1 for current Bigtable server time. - // Otherwise, the client should set this value itself, noting that the - // default value is a timestamp of zero if the field is left unspecified. - // Values must match the granularity of the table (e.g. micros, millis). - int64 timestamp_micros = 3; - - // The value to be written into the specified cell. - bytes value = 4; - } - - // A Mutation which deletes cells from the specified column, optionally - // restricting the deletions to a given timestamp range. - message DeleteFromColumn { - // The name of the family from which cells should be deleted. - // Must match `[-_.a-zA-Z0-9]+` - string family_name = 1; - - // The qualifier of the column from which cells should be deleted. - // Can be any byte string, including the empty string. - bytes column_qualifier = 2; - - // The range of timestamps within which cells should be deleted. - TimestampRange time_range = 3; - } - - // A Mutation which deletes all cells from the specified column family. - message DeleteFromFamily { - // The name of the family from which cells should be deleted. - // Must match `[-_.a-zA-Z0-9]+` - string family_name = 1; - } - - // A Mutation which deletes all cells from the containing row. - message DeleteFromRow { - - } - - // Which of the possible Mutation types to apply. - oneof mutation { - // Set a cell's value. - SetCell set_cell = 1; - - // Deletes cells from a column. - DeleteFromColumn delete_from_column = 2; - - // Deletes cells from a column family. - DeleteFromFamily delete_from_family = 3; - - // Deletes cells from the entire row. - DeleteFromRow delete_from_row = 4; - } -} - -// Specifies an atomic read/modify/write operation on the latest value of the -// specified column. -message ReadModifyWriteRule { - // The name of the family to which the read/modify/write should be applied. - // Must match `[-_.a-zA-Z0-9]+` - string family_name = 1; - - // The qualifier of the column to which the read/modify/write should be - // applied. - // Can be any byte string, including the empty string. - bytes column_qualifier = 2; - - // The rule used to determine the column's new latest value from its current - // latest value. - oneof rule { - // Rule specifying that `append_value` be appended to the existing value. - // If the targeted cell is unset, it will be treated as containing the - // empty string. - bytes append_value = 3; - - // Rule specifying that `increment_amount` be added to the existing value. - // If the targeted cell is unset, it will be treated as containing a zero. - // Otherwise, the targeted cell must contain an 8-byte value (interpreted - // as a 64-bit big-endian signed integer), or the entire request will fail. - int64 increment_amount = 4; - } -} diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js deleted file mode 100644 index 281ac8562..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName, rowKey) { - // [START bigtable_v2_generated_Bigtable_CheckAndMutateRow_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to which the conditional mutation should be - * applied. - * Values are of the form - * `projects//instances//tables/
`. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - /** - * Required. The key of the row to which the conditional mutation should be applied. - */ - // const rowKey = 'Buffer.from('string')' - /** - * The filter to be applied to the contents of the specified row. Depending - * on whether or not any results are yielded, either `true_mutations` or - * `false_mutations` will be executed. If unset, checks that the row contains - * any values at all. - */ - // const predicateFilter = {} - /** - * Changes to be atomically applied to the specified row if `predicate_filter` - * yields at least one cell when applied to `row_key`. Entries are applied in - * order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry if `false_mutations` is empty, and at most - * 100000. - */ - // const trueMutations = 1234 - /** - * Changes to be atomically applied to the specified row if `predicate_filter` - * does not yield any cells when applied to `row_key`. Entries are applied in - * order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry if `true_mutations` is empty, and at most - * 100000. - */ - // const falseMutations = 1234 - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callCheckAndMutateRow() { - // Construct request - const request = { - tableName, - rowKey, - }; - - // Run request - const response = await bigtableClient.checkAndMutateRow(request); - console.log(response); - } - - callCheckAndMutateRow(); - // [END bigtable_v2_generated_Bigtable_CheckAndMutateRow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js deleted file mode 100644 index 13e45188d..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName, rowKey, mutations) { - // [START bigtable_v2_generated_Bigtable_MutateRow_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to which the mutation should be applied. - * Values are of the form - * `projects//instances//tables/
`. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - /** - * Required. The key of the row to which the mutation should be applied. - */ - // const rowKey = 'Buffer.from('string')' - /** - * Required. Changes to be atomically applied to the specified row. Entries are applied - * in order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry and at most 100000. - */ - // const mutations = 1234 - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callMutateRow() { - // Construct request - const request = { - tableName, - rowKey, - mutations, - }; - - // Run request - const response = await bigtableClient.mutateRow(request); - console.log(response); - } - - callMutateRow(); - // [END bigtable_v2_generated_Bigtable_MutateRow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js deleted file mode 100644 index 3be0d8a4d..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName, entries) { - // [START bigtable_v2_generated_Bigtable_MutateRows_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to which the mutations should be applied. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - /** - * Required. The row keys and corresponding mutations to be applied in bulk. - * Each entry is applied as an atomic mutation, but the entries may be - * applied in arbitrary order (even between entries for the same row). - * At least one entry must be specified, and in total the entries can - * contain at most 100000 mutations. - */ - // const entries = 1234 - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callMutateRows() { - // Construct request - const request = { - tableName, - entries, - }; - - // Run request - const stream = await bigtableClient.mutateRows(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callMutateRows(); - // [END bigtable_v2_generated_Bigtable_MutateRows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js deleted file mode 100644 index c68e61757..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.ping_and_warm.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(name) { - // [START bigtable_v2_generated_Bigtable_PingAndWarm_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the instance to check permissions for as well as - * respond. Values are of the form `projects//instances/`. - */ - // const name = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callPingAndWarm() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await bigtableClient.pingAndWarm(request); - console.log(response); - } - - callPingAndWarm(); - // [END bigtable_v2_generated_Bigtable_PingAndWarm_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js deleted file mode 100644 index ae7934b8f..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName, rowKey, rules) { - // [START bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table to which the read/modify/write rules should be - * applied. - * Values are of the form - * `projects//instances//tables/
`. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - /** - * Required. The key of the row to which the read/modify/write rules should be applied. - */ - // const rowKey = 'Buffer.from('string')' - /** - * Required. Rules specifying how the specified row's contents are to be transformed - * into writes. Entries are applied in order, meaning that earlier rules will - * affect the results of later ones. - */ - // const rules = 1234 - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callReadModifyWriteRow() { - // Construct request - const request = { - tableName, - rowKey, - rules, - }; - - // Run request - const response = await bigtableClient.readModifyWriteRow(request); - console.log(response); - } - - callReadModifyWriteRow(); - // [END bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js deleted file mode 100644 index 9b5354905..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName) { - // [START bigtable_v2_generated_Bigtable_ReadRows_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table from which to read. - * Values are of the form - * `projects//instances//tables/
`. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - /** - * The row keys and/or ranges to read sequentially. If not specified, reads - * from all rows. - */ - // const rows = {} - /** - * The filter to apply to the contents of the specified row(s). If unset, - * reads the entirety of each row. - */ - // const filter = {} - /** - * The read will stop after committing to N rows' worth of results. The - * default (zero) is to return all results. - */ - // const rowsLimit = 1234 - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callReadRows() { - // Construct request - const request = { - tableName, - }; - - // Run request - const stream = await bigtableClient.readRows(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callReadRows(); - // [END bigtable_v2_generated_Bigtable_ReadRows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js deleted file mode 100644 index d7364fe17..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - /** - * NOTE: This sample is autogenerated, but this library contains handwritten - * samples that are the recommended way to use this library. Please refer to - * samples outside of the generated/ folder for these recommendations. - */ -'use strict'; - -function main(tableName) { - // [START bigtable_v2_generated_Bigtable_SampleRowKeys_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The unique name of the table from which to sample row keys. - * Values are of the form - * `projects//instances//tables/
`. - */ - // const tableName = 'abc123' - /** - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - */ - // const appProfileId = 'abc123' - - // Imports the Bigtable library - const {BigtableClient} = require('@google-cloud/bigtable').v2; - - // Instantiates a client - const bigtableClient = new BigtableClient(); - - async function callSampleRowKeys() { - // Construct request - const request = { - tableName, - }; - - // Run request - const stream = await bigtableClient.sampleRowKeys(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callSampleRowKeys(); - // [END bigtable_v2_generated_Bigtable_SampleRowKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json b/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json deleted file mode 100644 index 03d917cb9..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/snippet_metadata.google.bigtable.v2.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-bigtable", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.bigtable.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "bigtable_v2_generated_Bigtable_ReadRows_async", - "title": "bigtable readRows Sample", - "origin": "API_DEFINITION", - "description": " Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each. Depending on their size, rows and cells may be broken up across multiple responses, but atomicity of each row will still be preserved. See the ReadRowsResponse documentation for details.", - "canonical": false, - "file": "bigtable.read_rows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReadRows", - "fullName": "google.bigtable.v2.Bigtable.ReadRows", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "rows", - "type": ".google.bigtable.v2.RowSet" - }, - { - "name": "filter", - "type": ".google.bigtable.v2.RowFilter" - }, - { - "name": "rows_limit", - "type": "TYPE_INT64" - } - ], - "resultType": ".google.bigtable.v2.ReadRowsResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "ReadRows", - "fullName": "google.bigtable.v2.Bigtable.ReadRows", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_SampleRowKeys_async", - "title": "bigtable sampleRowKeys Sample", - "origin": "API_DEFINITION", - "description": " Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.", - "canonical": false, - "file": "bigtable.sample_row_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SampleRowKeys", - "fullName": "google.bigtable.v2.Bigtable.SampleRowKeys", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.v2.SampleRowKeysResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "SampleRowKeys", - "fullName": "google.bigtable.v2.Bigtable.SampleRowKeys", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_MutateRow_async", - "title": "bigtable mutateRow Sample", - "origin": "API_DEFINITION", - "description": " Mutates a row atomically. Cells already present in the row are left unchanged unless explicitly changed by `mutation`.", - "canonical": false, - "file": "bigtable.mutate_row.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MutateRow", - "fullName": "google.bigtable.v2.Bigtable.MutateRow", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "row_key", - "type": "TYPE_BYTES" - }, - { - "name": "mutations", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.v2.MutateRowResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "MutateRow", - "fullName": "google.bigtable.v2.Bigtable.MutateRow", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_MutateRows_async", - "title": "bigtable mutateRows Sample", - "origin": "API_DEFINITION", - "description": " Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.", - "canonical": false, - "file": "bigtable.mutate_rows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MutateRows", - "fullName": "google.bigtable.v2.Bigtable.MutateRows", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "entries", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.v2.MutateRowsResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "MutateRows", - "fullName": "google.bigtable.v2.Bigtable.MutateRows", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_CheckAndMutateRow_async", - "title": "bigtable checkAndMutateRow Sample", - "origin": "API_DEFINITION", - "description": " Mutates a row atomically based on the output of a predicate Reader filter.", - "canonical": false, - "file": "bigtable.check_and_mutate_row.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 90, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckAndMutateRow", - "fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "row_key", - "type": "TYPE_BYTES" - }, - { - "name": "predicate_filter", - "type": ".google.bigtable.v2.RowFilter" - }, - { - "name": "true_mutations", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "false_mutations", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.v2.CheckAndMutateRowResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "CheckAndMutateRow", - "fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_PingAndWarm_async", - "title": "bigtable pingAndWarm Sample", - "origin": "API_DEFINITION", - "description": " Warm up associated instance metadata for this connection. This call is not required but may be useful for connection keep-alive.", - "canonical": false, - "file": "bigtable.ping_and_warm.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PingAndWarm", - "fullName": "google.bigtable.v2.Bigtable.PingAndWarm", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.bigtable.v2.PingAndWarmResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "PingAndWarm", - "fullName": "google.bigtable.v2.Bigtable.PingAndWarm", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - }, - { - "regionTag": "bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async", - "title": "bigtable readModifyWriteRow Sample", - "origin": "API_DEFINITION", - "description": " Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.", - "canonical": false, - "file": "bigtable.read_modify_write_row.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 29, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReadModifyWriteRow", - "fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow", - "async": true, - "parameters": [ - { - "name": "table_name", - "type": "TYPE_STRING" - }, - { - "name": "app_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "row_key", - "type": "TYPE_BYTES" - }, - { - "name": "rules", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.bigtable.v2.ReadModifyWriteRowResponse", - "client": { - "shortName": "BigtableClient", - "fullName": "google.bigtable.v2.BigtableClient" - }, - "method": { - "shortName": "ReadModifyWriteRow", - "fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow", - "service": { - "shortName": "Bigtable", - "fullName": "google.bigtable.v2.Bigtable" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v2/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index b97a7779f..000000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const BigtableClient = v2.BigtableClient; -type BigtableClient = v2.BigtableClient; -export {v2, BigtableClient}; -export default {v2, BigtableClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v2/src/v2/bigtable_client.ts b/owl-bot-staging/v2/src/v2/bigtable_client.ts deleted file mode 100644 index 4f81201cc..000000000 --- a/owl-bot-staging/v2/src/v2/bigtable_client.ts +++ /dev/null @@ -1,925 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GoogleError} from 'google-gax'; - -import { PassThrough } from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/bigtable_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './bigtable_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Service for reading from and writing to existing Bigtable tables. - * @class - * @memberof v2 - */ -export class BigtableClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - bigtableStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BigtableClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BigtableClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}' - ), - tablePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/instances/{instance}/tables/{table}' - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - readRows: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING), - sampleRowKeys: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING), - mutateRows: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.bigtable.v2.Bigtable', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.bigtableStub) { - return this.bigtableStub; - } - - // Put together the "service stub" for - // google.bigtable.v2.Bigtable. - this.bigtableStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.bigtable.v2.Bigtable') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.bigtable.v2.Bigtable, - 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 bigtableStubMethods = - ['readRows', 'sampleRowKeys', 'mutateRow', 'mutateRows', 'checkAndMutateRow', 'pingAndWarm', 'readModifyWriteRow']; - for (const methodName of bigtableStubMethods) { - const callPromise = this.bigtableStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new GoogleError('The client has already been closed.')); - }); - return stream; - } - 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.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.bigtableStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'bigtable.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 'bigtable.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/bigtable.data', - 'https://www.googleapis.com/auth/bigtable.data.readonly', - 'https://www.googleapis.com/auth/cloud-bigtable.data', - 'https://www.googleapis.com/auth/cloud-bigtable.data.readonly', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - 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 -- - // ------------------- -/** - * Mutates a row atomically. Cells already present in the row are left - * unchanged unless explicitly changed by `mutation`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table to which the mutation should be applied. - * Values are of the form - * `projects//instances//tables/
`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {Buffer} request.rowKey - * Required. The key of the row to which the mutation should be applied. - * @param {number[]} request.mutations - * Required. Changes to be atomically applied to the specified row. Entries are applied - * in order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry and at most 100000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [MutateRowResponse]{@link google.bigtable.v2.MutateRowResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - */ - mutateRow( - request?: protos.google.bigtable.v2.IMutateRowRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|undefined, {}|undefined - ]>; - mutateRow( - request: protos.google.bigtable.v2.IMutateRowRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|null|undefined, - {}|null|undefined>): void; - mutateRow( - request: protos.google.bigtable.v2.IMutateRowRequest, - callback: Callback< - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|null|undefined, - {}|null|undefined>): void; - mutateRow( - request?: protos.google.bigtable.v2.IMutateRowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.v2.IMutateRowResponse, - protos.google.bigtable.v2.IMutateRowRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.mutateRow(request, options, callback); - } -/** - * Mutates a row atomically based on the output of a predicate Reader filter. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table to which the conditional mutation should be - * applied. - * Values are of the form - * `projects//instances//tables/
`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {Buffer} request.rowKey - * Required. The key of the row to which the conditional mutation should be applied. - * @param {google.bigtable.v2.RowFilter} request.predicateFilter - * The filter to be applied to the contents of the specified row. Depending - * on whether or not any results are yielded, either `true_mutations` or - * `false_mutations` will be executed. If unset, checks that the row contains - * any values at all. - * @param {number[]} request.trueMutations - * Changes to be atomically applied to the specified row if `predicate_filter` - * yields at least one cell when applied to `row_key`. Entries are applied in - * order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry if `false_mutations` is empty, and at most - * 100000. - * @param {number[]} request.falseMutations - * Changes to be atomically applied to the specified row if `predicate_filter` - * does not yield any cells when applied to `row_key`. Entries are applied in - * order, meaning that earlier mutations can be masked by later ones. - * Must contain at least one entry if `true_mutations` is empty, and at most - * 100000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CheckAndMutateRowResponse]{@link google.bigtable.v2.CheckAndMutateRowResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - */ - checkAndMutateRow( - request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|undefined, {}|undefined - ]>; - checkAndMutateRow( - request: protos.google.bigtable.v2.ICheckAndMutateRowRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, - {}|null|undefined>): void; - checkAndMutateRow( - request: protos.google.bigtable.v2.ICheckAndMutateRowRequest, - callback: Callback< - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, - {}|null|undefined>): void; - checkAndMutateRow( - request?: protos.google.bigtable.v2.ICheckAndMutateRowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.v2.ICheckAndMutateRowResponse, - protos.google.bigtable.v2.ICheckAndMutateRowRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.checkAndMutateRow(request, options, callback); - } -/** - * Warm up associated instance metadata for this connection. - * This call is not required but may be useful for connection keep-alive. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique name of the instance to check permissions for as well as - * respond. Values are of the form `projects//instances/`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [PingAndWarmResponse]{@link google.bigtable.v2.PingAndWarmResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - */ - pingAndWarm( - request?: protos.google.bigtable.v2.IPingAndWarmRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|undefined, {}|undefined - ]>; - pingAndWarm( - request: protos.google.bigtable.v2.IPingAndWarmRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, - {}|null|undefined>): void; - pingAndWarm( - request: protos.google.bigtable.v2.IPingAndWarmRequest, - callback: Callback< - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, - {}|null|undefined>): void; - pingAndWarm( - request?: protos.google.bigtable.v2.IPingAndWarmRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.v2.IPingAndWarmResponse, - protos.google.bigtable.v2.IPingAndWarmRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.name !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+').test(request.name!)){ - Object.assign(routingParameter, { name: request.name!.match(RegExp('(?projects/[^/]+/instances/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.pingAndWarm(request, options, callback); - } -/** - * Modifies a row atomically on the server. The method reads the latest - * existing timestamp and value from the specified columns and writes a new - * entry based on pre-defined read/modify/write rules. The new value for the - * timestamp is the greater of the existing timestamp or the current server - * time. The method returns the new contents of all modified cells. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table to which the read/modify/write rules should be - * applied. - * Values are of the form - * `projects//instances//tables/
`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {Buffer} request.rowKey - * Required. The key of the row to which the read/modify/write rules should be applied. - * @param {number[]} request.rules - * Required. Rules specifying how the specified row's contents are to be transformed - * into writes. Entries are applied in order, meaning that earlier rules will - * affect the results of later ones. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReadModifyWriteRowResponse]{@link google.bigtable.v2.ReadModifyWriteRowResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - */ - readModifyWriteRow( - request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest, - options?: CallOptions): - Promise<[ - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|undefined, {}|undefined - ]>; - readModifyWriteRow( - request: protos.google.bigtable.v2.IReadModifyWriteRowRequest, - options: CallOptions, - callback: Callback< - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, - {}|null|undefined>): void; - readModifyWriteRow( - request: protos.google.bigtable.v2.IReadModifyWriteRowRequest, - callback: Callback< - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, - {}|null|undefined>): void; - readModifyWriteRow( - request?: protos.google.bigtable.v2.IReadModifyWriteRowRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.bigtable.v2.IReadModifyWriteRowResponse, - protos.google.bigtable.v2.IReadModifyWriteRowRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.readModifyWriteRow(request, options, callback); - } - -/** - * Streams back the contents of all requested rows in key order, optionally - * applying the same Reader filter to each. Depending on their size, - * rows and cells may be broken up across multiple responses, but - * atomicity of each row will still be preserved. See the - * ReadRowsResponse documentation for details. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table from which to read. - * Values are of the form - * `projects//instances//tables/
`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {google.bigtable.v2.RowSet} request.rows - * The row keys and/or ranges to read sequentially. If not specified, reads - * from all rows. - * @param {google.bigtable.v2.RowFilter} request.filter - * The filter to apply to the contents of the specified row(s). If unset, - * reads the entirety of each row. - * @param {number} request.rowsLimit - * The read will stop after committing to N rows' worth of results. The - * default (zero) is to return all 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 [ReadRowsResponse]{@link google.bigtable.v2.ReadRowsResponse} on 'data' event. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) - * for more details and examples. - */ - readRows( - request?: protos.google.bigtable.v2.IReadRowsRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.readRows(request, options); - } - -/** - * Returns a sample of row keys in the table. The returned row keys will - * delimit contiguous sections of the table of approximately equal size, - * which can be used to break up the data for distributed tasks like - * mapreduces. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table from which to sample row keys. - * Values are of the form - * `projects//instances//tables/
`. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @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 [SampleRowKeysResponse]{@link google.bigtable.v2.SampleRowKeysResponse} on 'data' event. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) - * for more details and examples. - */ - sampleRowKeys( - request?: protos.google.bigtable.v2.ISampleRowKeysRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.sampleRowKeys(request, options); - } - -/** - * Mutates multiple rows in a batch. Each individual row is mutated - * atomically as in MutateRow, but the entire batch is not executed - * atomically. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.tableName - * Required. The unique name of the table to which the mutations should be applied. - * @param {string} request.appProfileId - * This value specifies routing for replication. If not specified, the - * "default" application profile will be used. - * @param {number[]} request.entries - * Required. The row keys and corresponding mutations to be applied in bulk. - * Each entry is applied as an atomic mutation, but the entries may be - * applied in arbitrary order (even between entries for the same row). - * At least one entry must be specified, and in total the entries can - * contain at most 100000 mutations. - * @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 [MutateRowsResponse]{@link google.bigtable.v2.MutateRowsResponse} on 'data' event. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming) - * for more details and examples. - */ - mutateRows( - request?: protos.google.bigtable.v2.IMutateRowsRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {};let routingParameter = {}; - if((typeof request.tableName !== "undefined") && RegExp('(?projects)/[^/]+/instances/[^/]+/tables/[^/]+').test(request.tableName!)){ - Object.assign(routingParameter, { table_name: request.tableName!.match(RegExp('(?projects/[^/]+/instances/[^/]+/tables/[^/]+)'))![0]})} - - if((typeof request.appProfileId !== "undefined") && RegExp('[^/]+').test(request.appProfileId!)){ - Object.assign(routingParameter, { app_profile_id: request.appProfileId!.match(RegExp('[^/]+'))![0]})} - - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams( - routingParameter - ); - this.initialize(); - return this.innerApiCalls.mutateRows(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified table resource name string. - * - * @param {string} project - * @param {string} instance - * @param {string} table - * @returns {string} Resource name string. - */ - tablePath(project:string,instance:string,table:string) { - return this.pathTemplates.tablePathTemplate.render({ - project: project, - instance: instance, - table: table, - }); - } - - /** - * Parse the project from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).project; - } - - /** - * Parse the instance from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).instance; - } - - /** - * Parse the table from Table resource. - * - * @param {string} tableName - * A fully-qualified path representing Table resource. - * @returns {string} A string representing the table. - */ - matchTableFromTableName(tableName: string) { - return this.pathTemplates.tablePathTemplate.match(tableName).table; - } - - /** - * 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.bigtableStub && !this._terminated) { - return this.bigtableStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v2/src/v2/bigtable_client_config.json b/owl-bot-staging/v2/src/v2/bigtable_client_config.json deleted file mode 100644 index 9a86aabbc..000000000 --- a/owl-bot-staging/v2/src/v2/bigtable_client_config.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "interfaces": { - "google.bigtable.v2.Bigtable": { - "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 - }, - "5af39a0f6db447f61c4f695240caeccb74f78362": { - "initial_retry_delay_millis": 10, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ReadRows": { - "timeout_millis": 43200000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SampleRowKeys": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "MutateRow": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "MutateRows": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CheckAndMutateRow": { - "timeout_millis": 20000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PingAndWarm": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReadModifyWriteRow": { - "timeout_millis": 20000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/bigtable_proto_list.json b/owl-bot-staging/v2/src/v2/bigtable_proto_list.json deleted file mode 100644 index f3b34ab8b..000000000 --- a/owl-bot-staging/v2/src/v2/bigtable_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/bigtable/v2/bigtable.proto", - "../../protos/google/bigtable/v2/data.proto" -] diff --git a/owl-bot-staging/v2/src/v2/gapic_metadata.json b/owl-bot-staging/v2/src/v2/gapic_metadata.json deleted file mode 100644 index cfaf1b67d..000000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.bigtable.v2", - "libraryPackage": "@google-cloud/bigtable", - "services": { - "Bigtable": { - "clients": { - "grpc": { - "libraryClient": "BigtableClient", - "rpcs": { - "MutateRow": { - "methods": [ - "mutateRow" - ] - }, - "CheckAndMutateRow": { - "methods": [ - "checkAndMutateRow" - ] - }, - "PingAndWarm": { - "methods": [ - "pingAndWarm" - ] - }, - "ReadModifyWriteRow": { - "methods": [ - "readModifyWriteRow" - ] - }, - "ReadRows": { - "methods": [ - "readRows" - ] - }, - "SampleRowKeys": { - "methods": [ - "sampleRowKeys" - ] - }, - "MutateRows": { - "methods": [ - "mutateRows" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BigtableClient", - "rpcs": { - "MutateRow": { - "methods": [ - "mutateRow" - ] - }, - "CheckAndMutateRow": { - "methods": [ - "checkAndMutateRow" - ] - }, - "PingAndWarm": { - "methods": [ - "pingAndWarm" - ] - }, - "ReadModifyWriteRow": { - "methods": [ - "readModifyWriteRow" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v2/src/v2/index.ts b/owl-bot-staging/v2/src/v2/index.ts deleted file mode 100644 index 6fea83b0c..000000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {BigtableClient} from './bigtable_client'; diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 693dcd77f..000000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const bigtable = require('@google-cloud/bigtable'); - -function main() { - const bigtableClient = new bigtable.BigtableClient(); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index de6e377da..000000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {BigtableClient} from '@google-cloud/bigtable'; - -// check that the client class type name can be used -function doStuffWithBigtableClient(client: BigtableClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const bigtableClient = new BigtableClient(); - doStuffWithBigtableClient(bigtableClient); -} - -main(); diff --git a/owl-bot-staging/v2/system-test/install.ts b/owl-bot-staging/v2/system-test/install.ts deleted file mode 100644 index 8ec452229..000000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v2/test/gapic_bigtable_v2.ts b/owl-bot-staging/v2/test/gapic_bigtable_v2.ts deleted file mode 100644 index 69a59d0f2..000000000 --- a/owl-bot-staging/v2/test/gapic_bigtable_v2.ts +++ /dev/null @@ -1,866 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as bigtableModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v2.BigtableClient', () => { - it('has servicePath', () => { - const servicePath = bigtableModule.v2.BigtableClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = bigtableModule.v2.BigtableClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = bigtableModule.v2.BigtableClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigtableModule.v2.BigtableClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigtableModule.v2.BigtableClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableStub, undefined); - await client.initialize(); - assert(client.bigtableStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.bigtableStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigtableStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigtableModule.v2.BigtableClient({ - 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 bigtableModule.v2.BigtableClient({ - 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('mutateRow', () => { - it('invokes mutateRow without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowResponse()); - client.innerApiCalls.mutateRow = stubSimpleCall(expectedResponse); - const [response] = await client.mutateRow(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.mutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes mutateRow without error using callback', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowResponse()); - client.innerApiCalls.mutateRow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.mutateRow( - request, - (err?: Error|null, result?: protos.google.bigtable.v2.IMutateRowResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.mutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes mutateRow with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.mutateRow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.mutateRow(request), expectedError); - assert((client.innerApiCalls.mutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes mutateRow with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.mutateRow(request), expectedError); - }); - }); - - describe('checkAndMutateRow', () => { - it('invokes checkAndMutateRow without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowResponse()); - client.innerApiCalls.checkAndMutateRow = stubSimpleCall(expectedResponse); - const [response] = await client.checkAndMutateRow(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.checkAndMutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkAndMutateRow without error using callback', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowResponse()); - client.innerApiCalls.checkAndMutateRow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkAndMutateRow( - request, - (err?: Error|null, result?: protos.google.bigtable.v2.ICheckAndMutateRowResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.checkAndMutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes checkAndMutateRow with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.checkAndMutateRow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAndMutateRow(request), expectedError); - assert((client.innerApiCalls.checkAndMutateRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkAndMutateRow with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.CheckAndMutateRowRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.checkAndMutateRow(request), expectedError); - }); - }); - - describe('pingAndWarm', () => { - it('invokes pingAndWarm without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmResponse()); - client.innerApiCalls.pingAndWarm = stubSimpleCall(expectedResponse); - const [response] = await client.pingAndWarm(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pingAndWarm as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pingAndWarm without error using callback', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmResponse()); - client.innerApiCalls.pingAndWarm = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pingAndWarm( - request, - (err?: Error|null, result?: protos.google.bigtable.v2.IPingAndWarmResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pingAndWarm as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes pingAndWarm with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.pingAndWarm = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pingAndWarm(request), expectedError); - assert((client.innerApiCalls.pingAndWarm as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pingAndWarm with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.PingAndWarmRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.pingAndWarm(request), expectedError); - }); - }); - - describe('readModifyWriteRow', () => { - it('invokes readModifyWriteRow without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowResponse()); - client.innerApiCalls.readModifyWriteRow = stubSimpleCall(expectedResponse); - const [response] = await client.readModifyWriteRow(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.readModifyWriteRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes readModifyWriteRow without error using callback', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowResponse()); - client.innerApiCalls.readModifyWriteRow = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.readModifyWriteRow( - request, - (err?: Error|null, result?: protos.google.bigtable.v2.IReadModifyWriteRowResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.readModifyWriteRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes readModifyWriteRow with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.readModifyWriteRow = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.readModifyWriteRow(request), expectedError); - assert((client.innerApiCalls.readModifyWriteRow as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes readModifyWriteRow with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadModifyWriteRowRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.readModifyWriteRow(request), expectedError); - }); - }); - - describe('readRows', () => { - it('invokes readRows without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsResponse()); - client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.readRows as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes readRows with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.readRows = stubServerStreamingCall(undefined, expectedError); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.readRows as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes readRows with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.ReadRowsRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - }); - - describe('sampleRowKeys', () => { - it('invokes sampleRowKeys without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysResponse()); - client.innerApiCalls.sampleRowKeys = stubServerStreamingCall(expectedResponse); - const stream = client.sampleRowKeys(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sampleRowKeys as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes sampleRowKeys with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.sampleRowKeys = stubServerStreamingCall(undefined, expectedError); - const stream = client.sampleRowKeys(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sampleRowKeys as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes sampleRowKeys with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.SampleRowKeysRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - const stream = client.sampleRowKeys(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.SampleRowKeysResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - }); - - describe('mutateRows', () => { - it('invokes mutateRows without error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsResponse()); - client.innerApiCalls.mutateRows = stubServerStreamingCall(expectedResponse); - const stream = client.mutateRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.mutateRows as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes mutateRows with error', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); - const expectedHeaderRequestParams = ""; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.mutateRows = stubServerStreamingCall(undefined, expectedError); - const stream = client.mutateRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.mutateRows as SinonStub) - .getCall(0).calledWith(request, expectedOptions)); - }); - - it('invokes mutateRows with closed client', async () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.bigtable.v2.MutateRowsRequest()); - const expectedError = new Error('The client has already been closed.'); - client.close(); - const stream = client.mutateRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.bigtable.v2.MutateRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - }); - - describe('Path templates', () => { - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - }; - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('table', () => { - const fakePath = "/rendered/path/table"; - const expectedParameters = { - project: "projectValue", - instance: "instanceValue", - table: "tableValue", - }; - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tablePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tablePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tablePath', () => { - const result = client.tablePath("projectValue", "instanceValue", "tableValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tablePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTableName', () => { - const result = client.matchProjectFromTableName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromTableName', () => { - const result = client.matchInstanceFromTableName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTableFromTableName', () => { - const result = client.matchTableFromTableName(fakePath); - assert.strictEqual(result, "tableValue"); - assert((client.pathTemplates.tablePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v2/tsconfig.json b/owl-bot-staging/v2/tsconfig.json deleted file mode 100644 index c78f1c884..000000000 --- a/owl-bot-staging/v2/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v2/webpack.config.js b/owl-bot-staging/v2/webpack.config.js deleted file mode 100644 index 9b488aad8..000000000 --- a/owl-bot-staging/v2/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'bigtable', - filename: './bigtable.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/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto index 76dbd914f..6dfc0e2a9 100644 --- a/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ b/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -274,6 +274,15 @@ service BigtableInstanceAdmin { }; option (google.api.method_signature) = "resource,permissions"; } + + // Lists hot tablets in a cluster, within the time range provided. Hot + // tablets are ordered based on CPU usage. + rpc ListHotTablets(ListHotTabletsRequest) returns (ListHotTabletsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" + }; + option (google.api.method_signature) = "parent"; + } } // Request message for BigtableInstanceAdmin.CreateInstance. @@ -634,3 +643,56 @@ message DeleteAppProfileRequest { message UpdateAppProfileMetadata { } + +// Request message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsRequest { + // Required. The cluster name to list hot tablets. + // Value is in the following form: + // `projects/{project}/instances/{instance}/clusters/{cluster}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Cluster" + } + ]; + + // The start time to list hot tablets. The hot tablets in the response will + // have start times between the requested start time and end time. Start time + // defaults to Now if it is unset, and end time defaults to Now - 24 hours if + // it is unset. The start time should be less than the end time, and the + // maximum allowed time range between start time and end time is 48 hours. + // Start time and end time should have values between Now and Now - 14 days. + google.protobuf.Timestamp start_time = 2; + + // The end time to list hot tablets. + google.protobuf.Timestamp end_time = 3; + + // Maximum number of results per page. + // + // A page_size that is empty or zero lets the server choose the number of + // items to return. A page_size which is strictly positive will return at most + // that many items. A negative page_size will cause an error. + // + // Following the first request, subsequent paginated calls do not need a + // page_size field. If a page_size is set in subsequent calls, it must match + // the page_size given in the first request. + int32 page_size = 4; + + // The value of `next_page_token` returned by a previous call. + string page_token = 5; +} + +// Response message for BigtableInstanceAdmin.ListHotTablets. +message ListHotTabletsResponse { + // List of hot tablets in the tables of the requested cluster that fall + // within the requested time range. Hot tablets are ordered by node cpu usage + // percent. If there are multiple hot tablets that correspond to the same + // tablet within a 15-minute interval, only the hot tablet with the highest + // node cpu usage will be included in the response. + repeated HotTablet hot_tablets = 1; + + // Set if not all hot tablets could be returned in a single response. + // Pass this value to `page_token` in another request to get the next + // page of results. + string next_page_token = 2; +} diff --git a/protos/google/bigtable/admin/v2/instance.proto b/protos/google/bigtable/admin/v2/instance.proto index 2e61b0858..c15b91411 100644 --- a/protos/google/bigtable/admin/v2/instance.proto +++ b/protos/google/bigtable/admin/v2/instance.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -291,3 +291,43 @@ message AppProfile { SingleClusterRouting single_cluster_routing = 6; } } + +// A tablet is a defined by a start and end key and is explained in +// https://cloud.google.com/bigtable/docs/overview#architecture and +// https://cloud.google.com/bigtable/docs/performance#optimization. +// A Hot tablet is a tablet that exhibits high average cpu usage during the time +// interval from start time to end time. +message HotTablet { + option (google.api.resource) = { + type: "bigtableadmin.googleapis.com/HotTablet" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + }; + + // The unique name of the hot tablet. Values are of the form + // `projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*`. + string name = 1; + + // Name of the table that contains the tablet. Values are of the form + // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. + string table_name = 2 [(google.api.resource_reference) = { + type: "bigtableadmin.googleapis.com/Table" + }]; + + // Output only. The start time of the hot tablet. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The end time of the hot tablet. + google.protobuf.Timestamp end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Tablet Start Key (inclusive). + string start_key = 5; + + // Tablet End Key (inclusive). + string end_key = 6; + + // Output only. The average CPU usage spent by a node on this tablet over the start_time to + // end_time time range. The percentage is the amount of CPU used by the node + // to serve the tablet, from 0% (tablet was not interacted with) to 100% (the + // node spent all cycles serving the hot tablet). + float node_cpu_usage_percent = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 1c9e11055..cc06d0e3a 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -325,6 +325,20 @@ export namespace google { * @returns Promise */ public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + + /** + * Calls ListHotTablets. + * @param request ListHotTabletsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListHotTabletsResponse + */ + public listHotTablets(request: google.bigtable.admin.v2.IListHotTabletsRequest, callback: google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTabletsCallback): void; + + /** + * Calls ListHotTablets. + * @param request ListHotTabletsRequest message or plain object + * @returns Promise + */ + public listHotTablets(request: google.bigtable.admin.v2.IListHotTabletsRequest): Promise; } namespace BigtableInstanceAdmin { @@ -468,6 +482,13 @@ export namespace google { * @param [response] TestIamPermissionsResponse */ type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * @param error Error, if any + * @param [response] ListHotTabletsResponse + */ + type ListHotTabletsCallback = (error: (Error|null), response?: google.bigtable.admin.v2.ListHotTabletsResponse) => void; } /** Properties of a CreateInstanceRequest. */ @@ -2822,6 +2843,216 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a ListHotTabletsRequest. */ + interface IListHotTabletsRequest { + + /** ListHotTabletsRequest parent */ + parent?: (string|null); + + /** ListHotTabletsRequest startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest pageSize */ + pageSize?: (number|null); + + /** ListHotTabletsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListHotTabletsRequest. */ + class ListHotTabletsRequest implements IListHotTabletsRequest { + + /** + * Constructs a new ListHotTabletsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IListHotTabletsRequest); + + /** ListHotTabletsRequest parent. */ + public parent: string; + + /** ListHotTabletsRequest startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** ListHotTabletsRequest pageSize. */ + public pageSize: number; + + /** ListHotTabletsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListHotTabletsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHotTabletsRequest instance + */ + public static create(properties?: google.bigtable.admin.v2.IListHotTabletsRequest): google.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Encodes the specified ListHotTabletsRequest message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. + * @param message ListHotTabletsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IListHotTabletsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHotTabletsRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. + * @param message ListHotTabletsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IListHotTabletsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHotTabletsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHotTabletsRequest + * @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.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Decodes a ListHotTabletsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHotTabletsRequest + * @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.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Verifies a ListHotTabletsRequest 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 ListHotTabletsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHotTabletsRequest + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.ListHotTabletsRequest; + + /** + * Creates a plain object from a ListHotTabletsRequest message. Also converts values to other types if specified. + * @param message ListHotTabletsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.ListHotTabletsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHotTabletsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListHotTabletsResponse. */ + interface IListHotTabletsResponse { + + /** ListHotTabletsResponse hotTablets */ + hotTablets?: (google.bigtable.admin.v2.IHotTablet[]|null); + + /** ListHotTabletsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListHotTabletsResponse. */ + class ListHotTabletsResponse implements IListHotTabletsResponse { + + /** + * Constructs a new ListHotTabletsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IListHotTabletsResponse); + + /** ListHotTabletsResponse hotTablets. */ + public hotTablets: google.bigtable.admin.v2.IHotTablet[]; + + /** ListHotTabletsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListHotTabletsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListHotTabletsResponse instance + */ + public static create(properties?: google.bigtable.admin.v2.IListHotTabletsResponse): google.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Encodes the specified ListHotTabletsResponse message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @param message ListHotTabletsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IListHotTabletsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListHotTabletsResponse message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @param message ListHotTabletsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IListHotTabletsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListHotTabletsResponse + * @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.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListHotTabletsResponse + * @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.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Verifies a ListHotTabletsResponse 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 ListHotTabletsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListHotTabletsResponse + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.ListHotTabletsResponse; + + /** + * Creates a plain object from a ListHotTabletsResponse message. Also converts values to other types if specified. + * @param message ListHotTabletsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.ListHotTabletsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListHotTabletsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an Instance. */ interface IInstance { @@ -3868,6 +4099,132 @@ export namespace google { } } + /** Properties of a HotTablet. */ + interface IHotTablet { + + /** HotTablet name */ + name?: (string|null); + + /** HotTablet tableName */ + tableName?: (string|null); + + /** HotTablet startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet startKey */ + startKey?: (string|null); + + /** HotTablet endKey */ + endKey?: (string|null); + + /** HotTablet nodeCpuUsagePercent */ + nodeCpuUsagePercent?: (number|null); + } + + /** Represents a HotTablet. */ + class HotTablet implements IHotTablet { + + /** + * Constructs a new HotTablet. + * @param [properties] Properties to set + */ + constructor(properties?: google.bigtable.admin.v2.IHotTablet); + + /** HotTablet name. */ + public name: string; + + /** HotTablet tableName. */ + public tableName: string; + + /** HotTablet startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** HotTablet startKey. */ + public startKey: string; + + /** HotTablet endKey. */ + public endKey: string; + + /** HotTablet nodeCpuUsagePercent. */ + public nodeCpuUsagePercent: number; + + /** + * Creates a new HotTablet instance using the specified properties. + * @param [properties] Properties to set + * @returns HotTablet instance + */ + public static create(properties?: google.bigtable.admin.v2.IHotTablet): google.bigtable.admin.v2.HotTablet; + + /** + * Encodes the specified HotTablet message. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @param message HotTablet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.bigtable.admin.v2.IHotTablet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HotTablet message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @param message HotTablet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.bigtable.admin.v2.IHotTablet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HotTablet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HotTablet + * @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.bigtable.admin.v2.HotTablet; + + /** + * Decodes a HotTablet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HotTablet + * @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.bigtable.admin.v2.HotTablet; + + /** + * Verifies a HotTablet 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 HotTablet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HotTablet + */ + public static fromObject(object: { [k: string]: any }): google.bigtable.admin.v2.HotTablet; + + /** + * Creates a plain object from a HotTablet message. Also converts values to other types if specified. + * @param message HotTablet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.bigtable.admin.v2.HotTablet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HotTablet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** StorageType enum. */ enum StorageType { STORAGE_TYPE_UNSPECIFIED = 0, diff --git a/protos/protos.js b/protos/protos.js index 0e08f5852..2732c14b2 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -758,6 +758,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.bigtable.admin.v2.BigtableInstanceAdmin#listHotTablets}. + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @typedef ListHotTabletsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.bigtable.admin.v2.ListHotTabletsResponse} [response] ListHotTabletsResponse + */ + + /** + * Calls ListHotTablets. + * @function listHotTablets + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} request ListHotTabletsRequest message or plain object + * @param {google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTabletsCallback} callback Node-style callback called with the error, if any, and ListHotTabletsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(BigtableInstanceAdmin.prototype.listHotTablets = function listHotTablets(request, callback) { + return this.rpcCall(listHotTablets, $root.google.bigtable.admin.v2.ListHotTabletsRequest, $root.google.bigtable.admin.v2.ListHotTabletsResponse, request, callback); + }, "name", { value: "ListHotTablets" }); + + /** + * Calls ListHotTablets. + * @function listHotTablets + * @memberof google.bigtable.admin.v2.BigtableInstanceAdmin + * @instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} request ListHotTabletsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return BigtableInstanceAdmin; })(); @@ -6243,30 +6276,28 @@ return UpdateAppProfileMetadata; })(); - v2.Instance = (function() { + v2.ListHotTabletsRequest = (function() { /** - * Properties of an Instance. + * Properties of a ListHotTabletsRequest. * @memberof google.bigtable.admin.v2 - * @interface IInstance - * @property {string|null} [name] Instance name - * @property {string|null} [displayName] Instance displayName - * @property {google.bigtable.admin.v2.Instance.State|null} [state] Instance state - * @property {google.bigtable.admin.v2.Instance.Type|null} [type] Instance type - * @property {Object.|null} [labels] Instance labels - * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + * @interface IListHotTabletsRequest + * @property {string|null} [parent] ListHotTabletsRequest parent + * @property {google.protobuf.ITimestamp|null} [startTime] ListHotTabletsRequest startTime + * @property {google.protobuf.ITimestamp|null} [endTime] ListHotTabletsRequest endTime + * @property {number|null} [pageSize] ListHotTabletsRequest pageSize + * @property {string|null} [pageToken] ListHotTabletsRequest pageToken */ /** - * Constructs a new Instance. + * Constructs a new ListHotTabletsRequest. * @memberof google.bigtable.admin.v2 - * @classdesc Represents an Instance. - * @implements IInstance + * @classdesc Represents a ListHotTabletsRequest. + * @implements IListHotTabletsRequest * @constructor - * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + * @param {google.bigtable.admin.v2.IListHotTabletsRequest=} [properties] Properties to set */ - function Instance(properties) { - this.labels = {}; + function ListHotTabletsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6274,160 +6305,127 @@ } /** - * Instance name. - * @member {string} name - * @memberof google.bigtable.admin.v2.Instance - * @instance - */ - Instance.prototype.name = ""; - - /** - * Instance displayName. - * @member {string} displayName - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest parent. + * @member {string} parent + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.displayName = ""; + ListHotTabletsRequest.prototype.parent = ""; /** - * Instance state. - * @member {google.bigtable.admin.v2.Instance.State} state - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.state = 0; + ListHotTabletsRequest.prototype.startTime = null; /** - * Instance type. - * @member {google.bigtable.admin.v2.Instance.Type} type - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.type = 0; + ListHotTabletsRequest.prototype.endTime = null; /** - * Instance labels. - * @member {Object.} labels - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest pageSize. + * @member {number} pageSize + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.labels = $util.emptyObject; + ListHotTabletsRequest.prototype.pageSize = 0; /** - * Instance createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.bigtable.admin.v2.Instance + * ListHotTabletsRequest pageToken. + * @member {string} pageToken + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @instance */ - Instance.prototype.createTime = null; + ListHotTabletsRequest.prototype.pageToken = ""; /** - * Creates a new Instance instance using the specified properties. + * Creates a new ListHotTabletsRequest instance using the specified properties. * @function create - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set - * @returns {google.bigtable.admin.v2.Instance} Instance instance + * @param {google.bigtable.admin.v2.IListHotTabletsRequest=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest instance */ - Instance.create = function create(properties) { - return new Instance(properties); + ListHotTabletsRequest.create = function create(properties) { + return new ListHotTabletsRequest(properties); }; /** - * Encodes the specified Instance message. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * Encodes the specified ListHotTabletsRequest message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. * @function encode - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} message ListHotTabletsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Instance.encode = function encode(message, writer) { + ListHotTabletsRequest.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); return writer; }; /** - * Encodes the specified Instance message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * Encodes the specified ListHotTabletsRequest message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static - * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {google.bigtable.admin.v2.IListHotTabletsRequest} message ListHotTabletsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Instance.encodeDelimited = function encodeDelimited(message, writer) { + ListHotTabletsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Instance message from the specified reader or buffer. + * Decodes a ListHotTabletsRequest message from the specified reader or buffer. * @function decode - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Instance.decode = function decode(reader, length) { + ListHotTabletsRequest.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.bigtable.admin.v2.Instance(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.bigtable.admin.v2.ListHotTabletsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); break; case 2: - message.displayName = reader.string(); + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.state = reader.int32(); + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 4: - message.type = reader.int32(); + message.pageSize = reader.int32(); break; case 5: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -6438,130 +6436,682 @@ }; /** - * Decodes an Instance message from the specified reader or buffer, length delimited. + * Decodes a ListHotTabletsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Instance.decodeDelimited = function decodeDelimited(reader) { + ListHotTabletsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Instance message. + * Verifies a ListHotTabletsRequest message. * @function verify - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Instance.verify = function verify(message) { + ListHotTabletsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); if (error) - return "createTime." + error; + return "endTime." + error; } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an Instance message from a plain object. Also converts values to their respective internal types. + * Creates a ListHotTabletsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.bigtable.admin.v2.Instance + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest * @static * @param {Object.} object Plain object - * @returns {google.bigtable.admin.v2.Instance} Instance + * @returns {google.bigtable.admin.v2.ListHotTabletsRequest} ListHotTabletsRequest */ - Instance.fromObject = function fromObject(object) { - if (object instanceof $root.google.bigtable.admin.v2.Instance) + ListHotTabletsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.ListHotTabletsRequest) return object; - var message = new $root.google.bigtable.admin.v2.Instance(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - switch (object.state) { - case "STATE_NOT_KNOWN": - case 0: - message.state = 0; - break; - case "READY": - case 1: - message.state = 1; - break; - case "CREATING": - case 2: - message.state = 2; - break; - } - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRODUCTION": - case 1: - message.type = 1; - break; - case "DEVELOPMENT": - case 2: - message.type = 2; - break; - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.bigtable.admin.v2.Instance.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + var message = new $root.google.bigtable.admin.v2.ListHotTabletsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsRequest.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.bigtable.admin.v2.Instance.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsRequest.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } - return message; - }; + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListHotTabletsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest + * @static + * @param {google.bigtable.admin.v2.ListHotTabletsRequest} message ListHotTabletsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHotTabletsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.startTime = null; + object.endTime = null; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + 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); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListHotTabletsRequest to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.ListHotTabletsRequest + * @instance + * @returns {Object.} JSON object + */ + ListHotTabletsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHotTabletsRequest; + })(); + + v2.ListHotTabletsResponse = (function() { + + /** + * Properties of a ListHotTabletsResponse. + * @memberof google.bigtable.admin.v2 + * @interface IListHotTabletsResponse + * @property {Array.|null} [hotTablets] ListHotTabletsResponse hotTablets + * @property {string|null} [nextPageToken] ListHotTabletsResponse nextPageToken + */ + + /** + * Constructs a new ListHotTabletsResponse. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a ListHotTabletsResponse. + * @implements IListHotTabletsResponse + * @constructor + * @param {google.bigtable.admin.v2.IListHotTabletsResponse=} [properties] Properties to set + */ + function ListHotTabletsResponse(properties) { + this.hotTablets = []; + 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]]; + } + + /** + * ListHotTabletsResponse hotTablets. + * @member {Array.} hotTablets + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + */ + ListHotTabletsResponse.prototype.hotTablets = $util.emptyArray; + + /** + * ListHotTabletsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + */ + ListHotTabletsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListHotTabletsResponse instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse instance + */ + ListHotTabletsResponse.create = function create(properties) { + return new ListHotTabletsResponse(properties); + }; + + /** + * Encodes the specified ListHotTabletsResponse message. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse} message ListHotTabletsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHotTabletsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hotTablets != null && message.hotTablets.length) + for (var i = 0; i < message.hotTablets.length; ++i) + $root.google.bigtable.admin.v2.HotTablet.encode(message.hotTablets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListHotTabletsResponse message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.ListHotTabletsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.IListHotTabletsResponse} message ListHotTabletsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListHotTabletsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHotTabletsResponse.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.bigtable.admin.v2.ListHotTabletsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.hotTablets && message.hotTablets.length)) + message.hotTablets = []; + message.hotTablets.push($root.google.bigtable.admin.v2.HotTablet.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListHotTabletsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListHotTabletsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListHotTabletsResponse message. + * @function verify + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListHotTabletsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hotTablets != null && message.hasOwnProperty("hotTablets")) { + if (!Array.isArray(message.hotTablets)) + return "hotTablets: array expected"; + for (var i = 0; i < message.hotTablets.length; ++i) { + var error = $root.google.bigtable.admin.v2.HotTablet.verify(message.hotTablets[i]); + if (error) + return "hotTablets." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListHotTabletsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.ListHotTabletsResponse} ListHotTabletsResponse + */ + ListHotTabletsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.ListHotTabletsResponse) + return object; + var message = new $root.google.bigtable.admin.v2.ListHotTabletsResponse(); + if (object.hotTablets) { + if (!Array.isArray(object.hotTablets)) + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsResponse.hotTablets: array expected"); + message.hotTablets = []; + for (var i = 0; i < object.hotTablets.length; ++i) { + if (typeof object.hotTablets[i] !== "object") + throw TypeError(".google.bigtable.admin.v2.ListHotTabletsResponse.hotTablets: object expected"); + message.hotTablets[i] = $root.google.bigtable.admin.v2.HotTablet.fromObject(object.hotTablets[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListHotTabletsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @static + * @param {google.bigtable.admin.v2.ListHotTabletsResponse} message ListHotTabletsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListHotTabletsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.hotTablets = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.hotTablets && message.hotTablets.length) { + object.hotTablets = []; + for (var j = 0; j < message.hotTablets.length; ++j) + object.hotTablets[j] = $root.google.bigtable.admin.v2.HotTablet.toObject(message.hotTablets[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListHotTabletsResponse to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.ListHotTabletsResponse + * @instance + * @returns {Object.} JSON object + */ + ListHotTabletsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListHotTabletsResponse; + })(); + + v2.Instance = (function() { + + /** + * Properties of an Instance. + * @memberof google.bigtable.admin.v2 + * @interface IInstance + * @property {string|null} [name] Instance name + * @property {string|null} [displayName] Instance displayName + * @property {google.bigtable.admin.v2.Instance.State|null} [state] Instance state + * @property {google.bigtable.admin.v2.Instance.Type|null} [type] Instance type + * @property {Object.|null} [labels] Instance labels + * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + */ + + /** + * Constructs a new Instance. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents an Instance. + * @implements IInstance + * @constructor + * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + */ + function Instance(properties) { + this.labels = {}; + 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]]; + } + + /** + * Instance name. + * @member {string} name + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.name = ""; + + /** + * Instance displayName. + * @member {string} displayName + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.displayName = ""; + + /** + * Instance state. + * @member {google.bigtable.admin.v2.Instance.State} state + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.state = 0; + + /** + * Instance type. + * @member {google.bigtable.admin.v2.Instance.Type} type + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.type = 0; + + /** + * Instance labels. + * @member {Object.} labels + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.labels = $util.emptyObject; + + /** + * Instance createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.bigtable.admin.v2.Instance + * @instance + */ + Instance.prototype.createTime = null; + + /** + * Creates a new Instance instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.Instance} Instance instance + */ + Instance.create = function create(properties) { + return new Instance(properties); + }; + + /** + * Encodes the specified Instance message. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Instance.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Instance message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.Instance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {google.bigtable.admin.v2.IInstance} message Instance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Instance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Instance message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.Instance} Instance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Instance.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.bigtable.admin.v2.Instance(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.type = reader.int32(); + break; + case 5: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Instance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.Instance} Instance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Instance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Instance message. + * @function verify + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Instance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an Instance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.Instance + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.Instance} Instance + */ + Instance.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.Instance) + return object; + var message = new $root.google.bigtable.admin.v2.Instance(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_NOT_KNOWN": + case 0: + message.state = 0; + break; + case "READY": + case 1: + message.state = 1; + break; + case "CREATING": + case 2: + message.state = 2; + break; + } + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRODUCTION": + case 1: + message.type = 1; + break; + case "DEVELOPMENT": + case 2: + message.type = 2; + break; + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.bigtable.admin.v2.Instance.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.bigtable.admin.v2.Instance.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; /** * Creates a plain object from an Instance message. Also converts values to other types if specified. @@ -8788,6 +9338,336 @@ return AppProfile; })(); + v2.HotTablet = (function() { + + /** + * Properties of a HotTablet. + * @memberof google.bigtable.admin.v2 + * @interface IHotTablet + * @property {string|null} [name] HotTablet name + * @property {string|null} [tableName] HotTablet tableName + * @property {google.protobuf.ITimestamp|null} [startTime] HotTablet startTime + * @property {google.protobuf.ITimestamp|null} [endTime] HotTablet endTime + * @property {string|null} [startKey] HotTablet startKey + * @property {string|null} [endKey] HotTablet endKey + * @property {number|null} [nodeCpuUsagePercent] HotTablet nodeCpuUsagePercent + */ + + /** + * Constructs a new HotTablet. + * @memberof google.bigtable.admin.v2 + * @classdesc Represents a HotTablet. + * @implements IHotTablet + * @constructor + * @param {google.bigtable.admin.v2.IHotTablet=} [properties] Properties to set + */ + function HotTablet(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]]; + } + + /** + * HotTablet name. + * @member {string} name + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.name = ""; + + /** + * HotTablet tableName. + * @member {string} tableName + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.tableName = ""; + + /** + * HotTablet startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.startTime = null; + + /** + * HotTablet endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.endTime = null; + + /** + * HotTablet startKey. + * @member {string} startKey + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.startKey = ""; + + /** + * HotTablet endKey. + * @member {string} endKey + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.endKey = ""; + + /** + * HotTablet nodeCpuUsagePercent. + * @member {number} nodeCpuUsagePercent + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + */ + HotTablet.prototype.nodeCpuUsagePercent = 0; + + /** + * Creates a new HotTablet instance using the specified properties. + * @function create + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet=} [properties] Properties to set + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet instance + */ + HotTablet.create = function create(properties) { + return new HotTablet(properties); + }; + + /** + * Encodes the specified HotTablet message. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @function encode + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet} message HotTablet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HotTablet.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.tableName != null && Object.hasOwnProperty.call(message, "tableName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableName); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.startKey != null && Object.hasOwnProperty.call(message, "startKey")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.startKey); + if (message.endKey != null && Object.hasOwnProperty.call(message, "endKey")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.endKey); + if (message.nodeCpuUsagePercent != null && Object.hasOwnProperty.call(message, "nodeCpuUsagePercent")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.nodeCpuUsagePercent); + return writer; + }; + + /** + * Encodes the specified HotTablet message, length delimited. Does not implicitly {@link google.bigtable.admin.v2.HotTablet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.IHotTablet} message HotTablet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HotTablet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HotTablet message from the specified reader or buffer. + * @function decode + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HotTablet.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.bigtable.admin.v2.HotTablet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.tableName = reader.string(); + break; + case 3: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.startKey = reader.string(); + break; + case 6: + message.endKey = reader.string(); + break; + case 7: + message.nodeCpuUsagePercent = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HotTablet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HotTablet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HotTablet message. + * @function verify + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HotTablet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.tableName != null && message.hasOwnProperty("tableName")) + if (!$util.isString(message.tableName)) + return "tableName: string 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; + } + if (message.startKey != null && message.hasOwnProperty("startKey")) + if (!$util.isString(message.startKey)) + return "startKey: string expected"; + if (message.endKey != null && message.hasOwnProperty("endKey")) + if (!$util.isString(message.endKey)) + return "endKey: string expected"; + if (message.nodeCpuUsagePercent != null && message.hasOwnProperty("nodeCpuUsagePercent")) + if (typeof message.nodeCpuUsagePercent !== "number") + return "nodeCpuUsagePercent: number expected"; + return null; + }; + + /** + * Creates a HotTablet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {Object.} object Plain object + * @returns {google.bigtable.admin.v2.HotTablet} HotTablet + */ + HotTablet.fromObject = function fromObject(object) { + if (object instanceof $root.google.bigtable.admin.v2.HotTablet) + return object; + var message = new $root.google.bigtable.admin.v2.HotTablet(); + if (object.name != null) + message.name = String(object.name); + if (object.tableName != null) + message.tableName = String(object.tableName); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.bigtable.admin.v2.HotTablet.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.bigtable.admin.v2.HotTablet.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.startKey != null) + message.startKey = String(object.startKey); + if (object.endKey != null) + message.endKey = String(object.endKey); + if (object.nodeCpuUsagePercent != null) + message.nodeCpuUsagePercent = Number(object.nodeCpuUsagePercent); + return message; + }; + + /** + * Creates a plain object from a HotTablet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.bigtable.admin.v2.HotTablet + * @static + * @param {google.bigtable.admin.v2.HotTablet} message HotTablet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HotTablet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.tableName = ""; + object.startTime = null; + object.endTime = null; + object.startKey = ""; + object.endKey = ""; + object.nodeCpuUsagePercent = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.tableName != null && message.hasOwnProperty("tableName")) + object.tableName = message.tableName; + 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); + if (message.startKey != null && message.hasOwnProperty("startKey")) + object.startKey = message.startKey; + if (message.endKey != null && message.hasOwnProperty("endKey")) + object.endKey = message.endKey; + if (message.nodeCpuUsagePercent != null && message.hasOwnProperty("nodeCpuUsagePercent")) + object.nodeCpuUsagePercent = options.json && !isFinite(message.nodeCpuUsagePercent) ? String(message.nodeCpuUsagePercent) : message.nodeCpuUsagePercent; + return object; + }; + + /** + * Converts this HotTablet to JSON. + * @function toJSON + * @memberof google.bigtable.admin.v2.HotTablet + * @instance + * @returns {Object.} JSON object + */ + HotTablet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HotTablet; + })(); + /** * StorageType enum. * @name google.bigtable.admin.v2.StorageType diff --git a/protos/protos.json b/protos/protos.json index 4486599ed..64b6e60f2 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -446,6 +446,24 @@ "(google.api.method_signature)": "resource,permissions" } ] + }, + "ListHotTablets": { + "requestType": "ListHotTabletsRequest", + "responseType": "ListHotTabletsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -865,6 +883,47 @@ "UpdateAppProfileMetadata": { "fields": {} }, + "ListHotTabletsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Cluster" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "pageSize": { + "type": "int32", + "id": 4 + }, + "pageToken": { + "type": "string", + "id": 5 + } + } + }, + "ListHotTabletsResponse": { + "fields": { + "hotTablets": { + "rule": "repeated", + "type": "HotTablet", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "Instance": { "options": { "(google.api.resource).type": "bigtableadmin.googleapis.com/Instance", @@ -1111,6 +1170,54 @@ } } }, + "HotTablet": { + "options": { + "(google.api.resource).type": "bigtableadmin.googleapis.com/HotTablet", + "(google.api.resource).pattern": "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "tableName": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "bigtableadmin.googleapis.com/Table" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "startKey": { + "type": "string", + "id": 5 + }, + "endKey": { + "type": "string", + "id": 6 + }, + "nodeCpuUsagePercent": { + "type": "float", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "StorageType": { "values": { "STORAGE_TYPE_UNSPECIFIED": 0, diff --git a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js b/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js similarity index 100% rename from owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js rename to samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js diff --git a/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json b/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json index 657432f09..7036bf8d5 100644 --- a/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json +++ b/samples/generated/v2/snippet_metadata.google.bigtable.admin.v2.json @@ -935,6 +935,62 @@ } } }, + { + "regionTag": "bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async", + "title": "bigtable listHotTablets Sample", + "origin": "API_DEFINITION", + "description": " Lists hot tablets in a cluster, within the time range provided. Hot tablets are ordered based on CPU usage.", + "canonical": true, + "file": "bigtable_instance_admin.list_hot_tablets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.bigtable.admin.v2.ListHotTabletsResponse", + "client": { + "shortName": "BigtableInstanceAdminClient", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdminClient" + }, + "method": { + "shortName": "ListHotTablets", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin.ListHotTablets", + "service": { + "shortName": "BigtableInstanceAdmin", + "fullName": "google.bigtable.admin.v2.BigtableInstanceAdmin" + } + } + } + }, { "regionTag": "bigtableadmin_v2_generated_BigtableTableAdmin_CreateTable_async", "title": "bigtable createTable Sample", diff --git a/src/v2/bigtable_instance_admin_client.ts b/src/v2/bigtable_instance_admin_client.ts index 6c2517af7..320849636 100644 --- a/src/v2/bigtable_instance_admin_client.ts +++ b/src/v2/bigtable_instance_admin_client.ts @@ -178,6 +178,9 @@ export class BigtableInstanceAdminClient { clusterPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/clusters/{cluster}' ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), instancePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}' ), @@ -201,6 +204,11 @@ export class BigtableInstanceAdminClient { 'nextPageToken', 'appProfiles' ), + listHotTablets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'hotTablets' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -357,6 +365,7 @@ export class BigtableInstanceAdminClient { 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', + 'listHotTablets', ]; for (const methodName of bigtableInstanceAdminStubMethods) { const callPromise = this.bigtableInstanceAdminStub.then( @@ -2760,6 +2769,253 @@ export class BigtableInstanceAdminClient { callSettings ) as AsyncIterable; } + /** + * Lists hot tablets in a cluster, within the time range provided. Hot + * tablets are ordered based on CPU usage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. + * 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 `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ] + >; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): void; + listHotTablets( + request: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + callback: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): void; + listHotTablets( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + >, + callback?: PaginationCallback< + protos.google.bigtable.admin.v2.IListHotTabletsRequest, + | protos.google.bigtable.admin.v2.IListHotTabletsResponse + | null + | undefined, + protos.google.bigtable.admin.v2.IHotTablet + > + ): Promise< + [ + protos.google.bigtable.admin.v2.IHotTablet[], + protos.google.bigtable.admin.v2.IListHotTabletsRequest | null, + protos.google.bigtable.admin.v2.IListHotTabletsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHotTablets(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 cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @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 [HotTablet]{@link google.bigtable.admin.v2.HotTablet} 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 `listHotTabletsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listHotTabletsStream( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.createStream( + this.innerApiCalls.listHotTablets as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listHotTablets`, 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 cluster name to list hot tablets. + * Value is in the following form: + * `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param {google.protobuf.Timestamp} request.startTime + * The start time to list hot tablets. The hot tablets in the response will + * have start times between the requested start time and end time. Start time + * defaults to Now if it is unset, and end time defaults to Now - 24 hours if + * it is unset. The start time should be less than the end time, and the + * maximum allowed time range between start time and end time is 48 hours. + * Start time and end time should have values between Now and Now - 14 days. + * @param {google.protobuf.Timestamp} request.endTime + * The end time to list hot tablets. + * @param {number} request.pageSize + * Maximum number of results per page. + * + * A page_size that is empty or zero lets the server choose the number of + * items to return. A page_size which is strictly positive will return at most + * that many items. A negative page_size will cause an error. + * + * Following the first request, subsequent paginated calls do not need a + * page_size field. If a page_size is set in subsequent calls, it must match + * the page_size given in the first request. + * @param {string} request.pageToken + * The value of `next_page_token` returned by a previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [HotTablet]{@link google.bigtable.admin.v2.HotTablet}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * region_tag:bigtableadmin_v2_generated_BigtableInstanceAdmin_ListHotTablets_async + */ + listHotTabletsAsync( + request?: protos.google.bigtable.admin.v2.IListHotTabletsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listHotTablets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHotTablets.asyncIterate( + this.innerApiCalls['listHotTablets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- @@ -2932,6 +3188,77 @@ export class BigtableInstanceAdminClient { return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; } + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath( + project: string, + instance: string, + cluster: string, + hotTablet: string + ) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .hot_tablet; + } + /** * Return a fully-qualified instance resource name string. * diff --git a/src/v2/bigtable_instance_admin_client_config.json b/src/v2/bigtable_instance_admin_client_config.json index 535ce9372..bb5e050c1 100644 --- a/src/v2/bigtable_instance_admin_client_config.json +++ b/src/v2/bigtable_instance_admin_client_config.json @@ -128,6 +128,11 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" + }, + "ListHotTablets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "264268458a9e88347dbacbd9398202ff5885a40b" } } } diff --git a/src/v2/bigtable_table_admin_client.ts b/src/v2/bigtable_table_admin_client.ts index 8caf897dd..769444792 100644 --- a/src/v2/bigtable_table_admin_client.ts +++ b/src/v2/bigtable_table_admin_client.ts @@ -179,6 +179,9 @@ export class BigtableTableAdminClient { clusterPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/clusters/{cluster}' ), + hotTabletPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}' + ), instancePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}' ), @@ -3434,6 +3437,77 @@ export class BigtableTableAdminClient { return this.pathTemplates.clusterPathTemplate.match(clusterName).cluster; } + /** + * Return a fully-qualified hotTablet resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} cluster + * @param {string} hot_tablet + * @returns {string} Resource name string. + */ + hotTabletPath( + project: string, + instance: string, + cluster: string, + hotTablet: string + ) { + return this.pathTemplates.hotTabletPathTemplate.render({ + project: project, + instance: instance, + cluster: cluster, + hot_tablet: hotTablet, + }); + } + + /** + * Parse the project from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .project; + } + + /** + * Parse the instance from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .instance; + } + + /** + * Parse the cluster from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the cluster. + */ + matchClusterFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .cluster; + } + + /** + * Parse the hot_tablet from HotTablet resource. + * + * @param {string} hotTabletName + * A fully-qualified path representing HotTablet resource. + * @returns {string} A string representing the hot_tablet. + */ + matchHotTabletFromHotTabletName(hotTabletName: string) { + return this.pathTemplates.hotTabletPathTemplate.match(hotTabletName) + .hot_tablet; + } + /** * Return a fully-qualified instance resource name string. * diff --git a/src/v2/gapic_metadata.json b/src/v2/gapic_metadata.json index f53c67d90..8faad0b19 100644 --- a/src/v2/gapic_metadata.json +++ b/src/v2/gapic_metadata.json @@ -111,6 +111,13 @@ "listAppProfilesStream", "listAppProfilesAsync" ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] } } }, @@ -218,6 +225,13 @@ "listAppProfilesStream", "listAppProfilesAsync" ] + }, + "ListHotTablets": { + "methods": [ + "listHotTablets", + "listHotTabletsStream", + "listHotTabletsAsync" + ] } } } diff --git a/test/gapic_bigtable_instance_admin_v2.ts b/test/gapic_bigtable_instance_admin_v2.ts index 53e3112cf..0b37f0ad8 100644 --- a/test/gapic_bigtable_instance_admin_v2.ts +++ b/test/gapic_bigtable_instance_admin_v2.ts @@ -3444,6 +3444,294 @@ describe('v2.BigtableInstanceAdminClient', () => { }); }); + describe('listHotTablets', () => { + it('invokes listHotTablets without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = stubSimpleCall(expectedResponse); + const [response] = await client.listHotTablets(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHotTablets without error using callback', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.innerApiCalls.listHotTablets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHotTablets( + request, + ( + err?: Error | null, + result?: protos.google.bigtable.admin.v2.IHotTablet[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listHotTablets with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHotTablets = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listHotTablets(request), expectedError); + assert( + (client.innerApiCalls.listHotTablets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listHotTabletsStream without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on( + 'data', + (response: protos.google.bigtable.admin.v2.HotTablet) => { + 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.listHotTablets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHotTablets, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHotTabletsStream with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listHotTabletsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.bigtable.admin.v2.HotTablet[] = []; + stream.on( + 'data', + (response: protos.google.bigtable.admin.v2.HotTablet) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listHotTablets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listHotTablets, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets without error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + generateSampleMessage(new protos.google.bigtable.admin.v2.HotTablet()), + ]; + client.descriptors.page.listHotTablets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + const iterable = client.listHotTabletsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHotTablets with error', async () => { + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.bigtable.admin.v2.ListHotTabletsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listHotTablets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHotTabletsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.bigtable.admin.v2.IHotTablet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listHotTablets.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('appProfile', () => { const fakePath = '/rendered/path/appProfile'; @@ -3652,6 +3940,83 @@ describe('v2.BigtableInstanceAdminClient', () => { }); }); + describe('hotTablet', () => { + const fakePath = '/rendered/path/hotTablet'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + cluster: 'clusterValue', + hot_tablet: 'hotTabletValue', + }; + const client = + new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath( + 'projectValue', + 'instanceValue', + 'clusterValue', + 'hotTabletValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, 'hotTabletValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('instance', () => { const fakePath = '/rendered/path/instance'; const expectedParameters = { diff --git a/test/gapic_bigtable_table_admin_v2.ts b/test/gapic_bigtable_table_admin_v2.ts index 2b320b4b4..370dedcda 100644 --- a/test/gapic_bigtable_table_admin_v2.ts +++ b/test/gapic_bigtable_table_admin_v2.ts @@ -3961,6 +3961,82 @@ describe('v2.BigtableTableAdminClient', () => { }); }); + describe('hotTablet', () => { + const fakePath = '/rendered/path/hotTablet'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + cluster: 'clusterValue', + hot_tablet: 'hotTabletValue', + }; + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hotTabletPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.hotTabletPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('hotTabletPath', () => { + const result = client.hotTabletPath( + 'projectValue', + 'instanceValue', + 'clusterValue', + 'hotTabletValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.hotTabletPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHotTabletName', () => { + const result = client.matchProjectFromHotTabletName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromHotTabletName', () => { + const result = client.matchInstanceFromHotTabletName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchClusterFromHotTabletName', () => { + const result = client.matchClusterFromHotTabletName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchHotTabletFromHotTabletName', () => { + const result = client.matchHotTabletFromHotTabletName(fakePath); + assert.strictEqual(result, 'hotTabletValue'); + assert( + (client.pathTemplates.hotTabletPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('instance', () => { const fakePath = '/rendered/path/instance'; const expectedParameters = {
include:samples/generated/v2/bigtable_instance_admin.list_hot_tablets.js