From 66a9d8fc32b4debcd20aaa61a391a47c9a4da936 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 19 Oct 2021 16:48:50 +0000 Subject: [PATCH 1/2] feat: Add create_time to Instance Committer: @gdcolella PiperOrigin-RevId: 404267819 Source-Link: https://github.com/googleapis/googleapis/commit/324f036d9dcc21318d89172ceaba5e0fd2377271 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2fada43b275eaaadd279838baf1120bddcffc762 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZhZGE0M2IyNzVlYWFhZGQyNzk4MzhiYWYxMTIwYmRkY2ZmYzc2MiJ9 --- 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 | 10 + owl-bot-staging/admin/v2/package.json | 65 + .../admin/v2/bigtable_instance_admin.proto | 574 +++ .../admin/v2/bigtable_table_admin.proto | 1003 ++++++ .../google/bigtable/admin/v2/common.proto | 54 + .../google/bigtable/admin/v2/instance.proto | 256 ++ .../google/bigtable/admin/v2/table.proto | 405 +++ ...table_instance_admin.create_app_profile.js | 72 + .../bigtable_instance_admin.create_cluster.js | 69 + ...bigtable_instance_admin.create_instance.js | 77 + ...table_instance_admin.delete_app_profile.js | 59 + .../bigtable_instance_admin.delete_cluster.js | 54 + ...bigtable_instance_admin.delete_instance.js | 54 + ...bigtable_instance_admin.get_app_profile.js | 54 + .../v2/bigtable_instance_admin.get_cluster.js | 54 + .../bigtable_instance_admin.get_iam_policy.js | 59 + .../bigtable_instance_admin.get_instance.js | 54 + ...gtable_instance_admin.list_app_profiles.js | 73 + .../bigtable_instance_admin.list_clusters.js | 60 + .../bigtable_instance_admin.list_instances.js | 58 + ..._instance_admin.partial_update_instance.js | 60 + .../bigtable_instance_admin.set_iam_policy.js | 62 + ...ble_instance_admin.test_iam_permissions.js | 62 + ...table_instance_admin.update_app_profile.js | 64 + .../bigtable_instance_admin.update_cluster.js | 85 + ...bigtable_instance_admin.update_instance.js | 90 + .../bigtable_table_admin.check_consistency.js | 60 + .../v2/bigtable_table_admin.create_backup.js | 71 + .../v2/bigtable_table_admin.create_table.js | 83 + ..._table_admin.create_table_from_snapshot.js | 69 + .../v2/bigtable_table_admin.delete_backup.js | 55 + .../bigtable_table_admin.delete_snapshot.js | 55 + .../v2/bigtable_table_admin.delete_table.js | 55 + .../v2/bigtable_table_admin.drop_row_range.js | 64 + ..._table_admin.generate_consistency_token.js | 55 + .../v2/bigtable_table_admin.get_backup.js | 55 + .../v2/bigtable_table_admin.get_iam_policy.js | 59 + .../v2/bigtable_table_admin.get_snapshot.js | 55 + .../v2/bigtable_table_admin.get_table.js | 60 + .../v2/bigtable_table_admin.list_backups.js | 121 + .../v2/bigtable_table_admin.list_snapshots.js | 68 + .../v2/bigtable_table_admin.list_tables.js | 75 + ...able_table_admin.modify_column_families.js | 63 + .../v2/bigtable_table_admin.restore_table.js | 69 + .../v2/bigtable_table_admin.set_iam_policy.js | 62 + .../v2/bigtable_table_admin.snapshot_table.js | 82 + ...gtable_table_admin.test_iam_permissions.js | 62 + .../v2/bigtable_table_admin.update_backup.js | 65 + owl-bot-staging/admin/v2/src/index.ts | 27 + .../src/v2/bigtable_instance_admin_client.ts | 2465 +++++++++++++ ...bigtable_instance_admin_client_config.json | 130 + .../bigtable_instance_admin_proto_list.json | 7 + .../v2/src/v2/bigtable_table_admin_client.ts | 3106 +++++++++++++++++ .../bigtable_table_admin_client_config.json | 143 + .../v2/bigtable_table_admin_proto_list.json | 7 + .../admin/v2/src/v2/gapic_metadata.json | 463 +++ 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 | 2543 ++++++++++++++ .../v2/test/gapic_bigtable_table_admin_v2.ts | 2978 ++++++++++++++++ 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 | 10 + owl-bot-staging/v2/package.json | 64 + .../protos/google/bigtable/v2/bigtable.proto | 427 +++ .../v2/protos/google/bigtable/v2/data.proto | 536 +++ .../v2/bigtable.check_and_mutate_row.js | 89 + .../generated/v2/bigtable.mutate_row.js | 72 + .../generated/v2/bigtable.mutate_rows.js | 69 + .../v2/bigtable.read_modify_write_row.js | 73 + .../generated/v2/bigtable.read_rows.js | 76 + .../generated/v2/bigtable.sample_row_keys.js | 62 + owl-bot-staging/v2/src/index.ts | 25 + owl-bot-staging/v2/src/v2/bigtable_client.ts | 780 +++++ .../v2/src/v2/bigtable_client_config.json | 65 + .../v2/src/v2/bigtable_proto_list.json | 4 + owl-bot-staging/v2/src/v2/gapic_metadata.json | 68 + 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 | 636 ++++ owl-bot-staging/v2/tsconfig.json | 19 + owl-bot-staging/v2/webpack.config.js | 64 + 100 files changed, 20673 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_instances.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/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.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/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..1a3b4732d --- /dev/null +++ b/owl-bot-staging/admin/v2/.jsdoc.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file 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 2021 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..50bc7f792 --- /dev/null +++ b/owl-bot-staging/admin/v2/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** 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..84f4713a0 --- /dev/null +++ b/owl-bot-staging/admin/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** 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..29a223b6d --- /dev/null +++ b/owl-bot-staging/admin/v2/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/admin/v2/package.json b/owl-bot-staging/admin/v2/package.json new file mode 100644 index 000000000..03ce0fce6 --- /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.19.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^9.0.2", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "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..ca3aaed7a --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto @@ -0,0 +1,574 @@ +// 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/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. + 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. + 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. + 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" + }; + } + + // 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"; + } +} + +// 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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; +} + +// 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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 { + +} 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..ff2076c50 --- /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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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..17c69d469 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto @@ -0,0 +1,54 @@ +// 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/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 = "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..ed811ef27 --- /dev/null +++ b/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto @@ -0,0 +1,256 @@ +// 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/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: "bigtable.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]; +} + +// 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: "bigtable.googleapis.com/Cluster" + pattern: "projects/{project}/instances/{instance}/clusters/{cluster}" + }; + + // 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]; + + // Required. The number of nodes allocated to this cluster. More nodes enable + // higher throughput and more consistent performance. + int32 serve_nodes = 4 [(google.api.field_behavior) = REQUIRED]; + + // (`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: "bigtable.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; + } +} 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..a5578225e --- /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: "bigtable.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: "bigtable.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: "bigtable.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..d248861c5 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js @@ -0,0 +1,72 @@ +// 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. + + +'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 createAppProfile() { + // Construct request + const request = { + parent, + appProfileId, + appProfile, + }; + + // Run request + const response = await adminClient.createAppProfile(request); + console.log(response); + } + + createAppProfile(); + // [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..e2e9dbf81 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js @@ -0,0 +1,69 @@ +// 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. + + +'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 createCluster() { + // Construct request + const request = { + parent, + clusterId, + cluster, + }; + + // Run request + const [operation] = await adminClient.createCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + createCluster(); + // [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..bcb432bdc --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js @@ -0,0 +1,77 @@ +// 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. + + +'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 createInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + clusters, + }; + + // Run request + const [operation] = await adminClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + createInstance(); + // [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..ba375c0ae --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js @@ -0,0 +1,59 @@ +// 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. + + +'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 deleteAppProfile() { + // Construct request + const request = { + name, + ignoreWarnings, + }; + + // Run request + const response = await adminClient.deleteAppProfile(request); + console.log(response); + } + + deleteAppProfile(); + // [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..ce6912fa8 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js @@ -0,0 +1,54 @@ +// 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. + + +'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 deleteCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteCluster(request); + console.log(response); + } + + deleteCluster(); + // [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..fd3350ce0 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js @@ -0,0 +1,54 @@ +// 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. + + +'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 deleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteInstance(request); + console.log(response); + } + + deleteInstance(); + // [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..735c02e6c --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js @@ -0,0 +1,54 @@ +// 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. + + +'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 getAppProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getAppProfile(request); + console.log(response); + } + + getAppProfile(); + // [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..c1bfa4066 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js @@ -0,0 +1,54 @@ +// 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. + + +'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 getCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getCluster(request); + console.log(response); + } + + getCluster(); + // [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..2290a91bb --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js @@ -0,0 +1,59 @@ +// 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. + + +'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 getIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await adminClient.getIamPolicy(request); + console.log(response); + } + + getIamPolicy(); + // [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..4b3e12346 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js @@ -0,0 +1,54 @@ +// 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. + + +'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 getInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getInstance(request); + console.log(response); + } + + getInstance(); + // [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..3db250168 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js @@ -0,0 +1,73 @@ +// 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. + + +'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 listAppProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listAppProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAppProfiles(); + // [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..7c2fd4e5d --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js @@ -0,0 +1,60 @@ +// 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. + + +'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 listClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listClusters(request); + console.log(response); + } + + listClusters(); + // [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 new file mode 100644 index 000000000..215d2e87b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js @@ -0,0 +1,58 @@ +// 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. + + +'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 listInstances() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await adminClient.listInstances(request); + console.log(response); + } + + listInstances(); + // [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_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js new file mode 100644 index 000000000..f2e424559 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js @@ -0,0 +1,60 @@ +// 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. + + +'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 partialUpdateInstance() { + // Construct request + const request = { + instance, + updateMask, + }; + + // Run request + const [operation] = await adminClient.partialUpdateInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + partialUpdateInstance(); + // [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..12d21d6f0 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js @@ -0,0 +1,62 @@ +// 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. + + +'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 setIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await adminClient.setIamPolicy(request); + console.log(response); + } + + setIamPolicy(); + // [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..a3c0984dd --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js @@ -0,0 +1,62 @@ +// 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. + + +'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 testIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await adminClient.testIamPermissions(request); + console.log(response); + } + + testIamPermissions(); + // [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..248dbd756 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.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 +// +// 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. + + +'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 updateAppProfile() { + // Construct request + const request = { + appProfile, + updateMask, + }; + + // Run request + const [operation] = await adminClient.updateAppProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + updateAppProfile(); + // [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..33603c42e --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js @@ -0,0 +1,85 @@ +// 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. + + +'use strict'; + +function main(name, state, serveNodes, 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 = '' + /** + * Required. The number of nodes allocated to this cluster. More nodes enable + * higher throughput and more consistent performance. + */ + // const serveNodes = 1234 + /** + * (`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 updateCluster() { + // Construct request + const request = { + name, + state, + serveNodes, + encryptionConfig, + }; + + // Run request + const [operation] = await adminClient.updateCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + updateCluster(); + // [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..4463c8d6b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js @@ -0,0 +1,90 @@ +// 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. + + +'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 updateInstance() { + // Construct request + const request = { + name, + displayName, + createTime, + }; + + // Run request + const response = await adminClient.updateInstance(request); + console.log(response); + } + + updateInstance(); + // [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..a95a2d7f0 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js @@ -0,0 +1,60 @@ +// 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. + + +'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 checkConsistency() { + // Construct request + const request = { + name, + consistencyToken, + }; + + // Run request + const response = await adminClient.checkConsistency(request); + console.log(response); + } + + checkConsistency(); + // [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..3e325a59e --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js @@ -0,0 +1,71 @@ +// 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. + + +'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 createBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await adminClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + createBackup(); + // [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..86c9a382a --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js @@ -0,0 +1,83 @@ +// 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. + + +'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 createTable() { + // Construct request + const request = { + parent, + tableId, + table, + }; + + // Run request + const response = await adminClient.createTable(request); + console.log(response); + } + + createTable(); + // [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..d75234081 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js @@ -0,0 +1,69 @@ +// 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. + + +'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 createTableFromSnapshot() { + // Construct request + const request = { + parent, + tableId, + sourceSnapshot, + }; + + // Run request + const [operation] = await adminClient.createTableFromSnapshot(request); + const [response] = await operation.promise(); + console.log(response); + } + + createTableFromSnapshot(); + // [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..f9e5f60f5 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js @@ -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. + + +'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 deleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteBackup(request); + console.log(response); + } + + deleteBackup(); + // [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..76fd831b8 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js @@ -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. + + +'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 deleteSnapshot() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteSnapshot(request); + console.log(response); + } + + deleteSnapshot(); + // [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..ff9f526a1 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js @@ -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. + + +'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 deleteTable() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.deleteTable(request); + console.log(response); + } + + deleteTable(); + // [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..3cf2d82d3 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.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 +// +// 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. + + +'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 dropRowRange() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.dropRowRange(request); + console.log(response); + } + + dropRowRange(); + // [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..8b344c122 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js @@ -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. + + +'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 generateConsistencyToken() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.generateConsistencyToken(request); + console.log(response); + } + + generateConsistencyToken(); + // [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..58eb2fdca --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js @@ -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. + + +'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 getBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getBackup(request); + console.log(response); + } + + getBackup(); + // [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..f413fe2e3 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js @@ -0,0 +1,59 @@ +// 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. + + +'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 getIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await adminClient.getIamPolicy(request); + console.log(response); + } + + getIamPolicy(); + // [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..be11488fa --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js @@ -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. + + +'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 getSnapshot() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getSnapshot(request); + console.log(response); + } + + getSnapshot(); + // [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..a3b8f961b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js @@ -0,0 +1,60 @@ +// 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. + + +'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 getTable() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await adminClient.getTable(request); + console.log(response); + } + + getTable(); + // [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..9129bcb71 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js @@ -0,0 +1,121 @@ +// 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. + + +'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 listBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listBackups(); + // [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..a9cc84086 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js @@ -0,0 +1,68 @@ +// 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. + + +'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 listSnapshots() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listSnapshotsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listSnapshots(); + // [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..9dac9771f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js @@ -0,0 +1,75 @@ +// 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. + + +'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 listTables() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await adminClient.listTablesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listTables(); + // [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..d5c051f5b --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js @@ -0,0 +1,63 @@ +// 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. + + +'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 modifyColumnFamilies() { + // Construct request + const request = { + name, + modifications, + }; + + // Run request + const response = await adminClient.modifyColumnFamilies(request); + console.log(response); + } + + modifyColumnFamilies(); + // [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..070673522 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js @@ -0,0 +1,69 @@ +// 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. + + +'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 restoreTable() { + // Construct request + const request = { + parent, + tableId, + }; + + // Run request + const [operation] = await adminClient.restoreTable(request); + const [response] = await operation.promise(); + console.log(response); + } + + restoreTable(); + // [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..e5f2ceba5 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js @@ -0,0 +1,62 @@ +// 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. + + +'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 setIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await adminClient.setIamPolicy(request); + console.log(response); + } + + setIamPolicy(); + // [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..bfe7ca864 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js @@ -0,0 +1,82 @@ +// 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. + + +'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 snapshotTable() { + // Construct request + const request = { + name, + cluster, + snapshotId, + }; + + // Run request + const [operation] = await adminClient.snapshotTable(request); + const [response] = await operation.promise(); + console.log(response); + } + + snapshotTable(); + // [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..dba7d267f --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js @@ -0,0 +1,62 @@ +// 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. + + +'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 testIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await adminClient.testIamPermissions(request); + console.log(response); + } + + testIamPermissions(); + // [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..dcf247450 --- /dev/null +++ b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js @@ -0,0 +1,65 @@ +// 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. + + +'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 updateBackup() { + // Construct request + const request = { + backup, + updateMask, + }; + + // Run request + const response = await adminClient.updateBackup(request); + console.log(response); + } + + updateBackup(); + // [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/src/index.ts b/owl-bot-staging/admin/v2/src/index.ts new file mode 100644 index 000000000..73054c954 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/index.ts @@ -0,0 +1,27 @@ +// 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. +// +// ** 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..97d86954f --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts @@ -0,0 +1,2465 @@ +// 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. +// +// ** 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}' + ), + 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') + }; + + 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 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)), + 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', 'deleteCluster', 'createAppProfile', 'getAppProfile', 'listAppProfiles', 'updateAppProfile', 'deleteAppProfile', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; + 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 -- + // ------------------- + 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; +/** + * 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 + * const [response] = await client.getInstance(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.listInstances(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.updateInstance(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteInstance(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getCluster(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.listClusters(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteCluster(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.createAppProfile(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getAppProfile(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteAppProfile(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getIamPolicy(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.setIamPolicy(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.testIamPermissions(request); + */ + 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); + } + + 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; +/** + * Create an instance within a project. + * + * @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 + * const [operation] = await client.createInstance(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkCreateInstanceProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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 + * const [operation] = await client.partialUpdateInstance(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkPartialUpdateInstanceProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * Creates a cluster 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 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 + * const [operation] = await client.createCluster(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkCreateClusterProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * Updates a cluster within an instance. + * + * @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 + * Required. The number of nodes allocated to this cluster. More nodes enable + * higher throughput and more consistent performance. + * @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 + * const [operation] = await client.updateCluster(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkUpdateClusterProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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 + * const [operation] = await client.updateAppProfile(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkUpdateAppProfileProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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, + 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 + * const iterable = client.listAppProfilesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + 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 || '', + }); + options = options || {}; + 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; + } + // -------------------- + // -- 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 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 { + this.initialize(); + if (!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..2f6b84535 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json @@ -0,0 +1,130 @@ +{ + "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" + }, + "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" + } + } + } + } +} 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..d26111919 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts @@ -0,0 +1,3106 @@ +// 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. +// +// ** 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}' + ), + 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 -- + // ------------------- + 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; +/** + * 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 + * const [response] = await client.createTable(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getTable(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteTable(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.modifyColumnFamilies(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.dropRowRange(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.generateConsistencyToken(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.checkConsistency(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getSnapshot(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteSnapshot(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getBackup(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.updateBackup(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.deleteBackup(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.getIamPolicy(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.setIamPolicy(request); + */ + 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); + } + 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; +/** + * 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 + * const [response] = await client.testIamPermissions(request); + */ + 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); + } + + 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; +/** + * 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 + * const [operation] = await client.createTableFromSnapshot(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkCreateTableFromSnapshotProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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 + * const [operation] = await client.snapshotTable(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkSnapshotTableProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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 + * const [operation] = await client.createBackup(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkCreateBackupProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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 + * const [operation] = await client.restoreTable(request); + * const [response] = await operation.promise(); + */ + 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 + * const decodedOperation = await checkRestoreTableProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + 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; + } + 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; +/** + * 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, + 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 + * const iterable = client.listTablesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + 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 || '', + }); + options = options || {}; + 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; + } + 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; +/** + * 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, + 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 + * const iterable = client.listSnapshotsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + 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 || '', + }); + options = options || {}; + 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; + } + 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; +/** + * 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, + 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 + * const iterable = client.listBackupsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + 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 || '', + }); + options = options || {}; + 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 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 { + this.initialize(); + if (!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..7c0177a6c --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json @@ -0,0 +1,463 @@ +{ + "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" + ] + }, + "UpdateAppProfile": { + "methods": [ + "updateAppProfile" + ] + }, + "ListAppProfiles": { + "methods": [ + "listAppProfiles", + "listAppProfilesStream", + "listAppProfilesAsync" + ] + } + } + }, + "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" + ] + }, + "UpdateAppProfile": { + "methods": [ + "updateAppProfile" + ] + }, + "ListAppProfiles": { + "methods": [ + "listAppProfiles", + "listAppProfilesStream", + "listAppProfilesAsync" + ] + } + } + } + } + }, + "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..b1c8a1db1 --- /dev/null +++ b/owl-bot-staging/admin/v2/src/v2/index.ts @@ -0,0 +1,20 @@ +// 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. +// +// ** 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..57e93d843 --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// 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. +// +// ** 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..6c7330447 --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// 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. +// +// ** 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..1f850b522 --- /dev/null +++ b/owl-bot-staging/admin/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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..d1e9e8086 --- /dev/null +++ b/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts @@ -0,0 +1,2543 @@ +// 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. +// +// ** 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', () => { + const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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('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('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('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..1d6e155d7 --- /dev/null +++ b/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts @@ -0,0 +1,2978 @@ +// 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. +// +// ** 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', () => { + const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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)); + }); + }); + + 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('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..1a3b4732d --- /dev/null +++ b/owl-bot-staging/v2/.jsdoc.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file 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 2021 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..50bc7f792 --- /dev/null +++ b/owl-bot-staging/v2/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** 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..84f4713a0 --- /dev/null +++ b/owl-bot-staging/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** 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..29a223b6d --- /dev/null +++ b/owl-bot-staging/v2/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json new file mode 100644 index 000000000..51cb1cceb --- /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.19.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^9.0.2", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "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..32aaba21d --- /dev/null +++ b/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto @@ -0,0 +1,427 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.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/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: "bigtable.googleapis.com/Table" + pattern: "projects/{project}/instances/{instance}/tables/{table}" +}; + +// 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.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.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.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.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.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"; + } + + // 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.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: "bigtable.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. 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 terminate 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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 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: "bigtable.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..2cc916454 --- /dev/null +++ b/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto @@ -0,0 +1,536 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.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 4096 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..64ec1054a --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js @@ -0,0 +1,89 @@ +// 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. + + +'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 checkAndMutateRow() { + // Construct request + const request = { + tableName, + rowKey, + }; + + // Run request + const response = await bigtableClient.checkAndMutateRow(request); + console.log(response); + } + + checkAndMutateRow(); + // [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..a5977562e --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js @@ -0,0 +1,72 @@ +// 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. + + +'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 mutateRow() { + // Construct request + const request = { + tableName, + rowKey, + mutations, + }; + + // Run request + const response = await bigtableClient.mutateRow(request); + console.log(response); + } + + mutateRow(); + // [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..c397cae00 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js @@ -0,0 +1,69 @@ +// 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. + + +'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 mutateRows() { + // 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 */ }); + } + + mutateRows(); + // [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.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..e504278dd --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js @@ -0,0 +1,73 @@ +// 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. + + +'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 readModifyWriteRow() { + // Construct request + const request = { + tableName, + rowKey, + rules, + }; + + // Run request + const response = await bigtableClient.readModifyWriteRow(request); + console.log(response); + } + + readModifyWriteRow(); + // [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..ce5ec5cd6 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js @@ -0,0 +1,76 @@ +// 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. + + +'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. 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 terminate 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 readRows() { + // 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 */ }); + } + + readRows(); + // [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..37a8e1408 --- /dev/null +++ b/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js @@ -0,0 +1,62 @@ +// 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. + + +'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 sampleRowKeys() { + // 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 */ }); + } + + sampleRowKeys(); + // [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/src/index.ts b/owl-bot-staging/v2/src/index.ts new file mode 100644 index 000000000..9920fa2b4 --- /dev/null +++ b/owl-bot-staging/v2/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** 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..3231d9dc4 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/bigtable_client.ts @@ -0,0 +1,780 @@ +// 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. +// +// ** 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} from 'google-gax'; + +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 = { + 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', 'readModifyWriteRow']; + for (const methodName of bigtableStubMethods) { + const callPromise = this.bigtableStub.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.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 -- + // ------------------- + 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; +/** + * 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. + * @example + * const [response] = await client.mutateRow(request); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + this.initialize(); + return this.innerApiCalls.mutateRow(request, options, callback); + } + 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; +/** + * 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. + * @example + * const [response] = await client.checkAndMutateRow(request); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + this.initialize(); + return this.innerApiCalls.checkAndMutateRow(request, options, callback); + } + 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; +/** + * 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. + * @example + * const [response] = await client.readModifyWriteRow(request); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + 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. 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 terminate 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. + * @example + * const stream = client.readRows(request); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + 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. + * @example + * const stream = client.sampleRowKeys(request); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + 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. + * @example + * const stream = client.mutateRows(request); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + */ + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'table_name': request.tableName || '', + }); + this.initialize(); + return this.innerApiCalls.mutateRows(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * 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 { + this.initialize(); + if (!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..2c2765aa6 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/bigtable_client_config.json @@ -0,0 +1,65 @@ +{ + "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": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "SampleRowKeys": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "MutateRow": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "MutateRows": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "CheckAndMutateRow": { + "timeout_millis": 20000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + }, + "ReadModifyWriteRow": { + "timeout_millis": 20000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" + } + } + } + } +} 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..6e578d2c9 --- /dev/null +++ b/owl-bot-staging/v2/src/v2/gapic_metadata.json @@ -0,0 +1,68 @@ +{ + "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" + ] + }, + "ReadModifyWriteRow": { + "methods": [ + "readModifyWriteRow" + ] + }, + "ReadRows": { + "methods": [ + "readRows" + ] + }, + "SampleRowKeys": { + "methods": [ + "sampleRowKeys" + ] + }, + "MutateRows": { + "methods": [ + "mutateRows" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BigtableClient", + "rpcs": { + "MutateRow": { + "methods": [ + "mutateRow" + ] + }, + "CheckAndMutateRow": { + "methods": [ + "checkAndMutateRow" + ] + }, + "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..03c68bbff --- /dev/null +++ b/owl-bot-staging/v2/src/v2/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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..d09f0fc9d --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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..a9734010c --- /dev/null +++ b/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** 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..1f850b522 --- /dev/null +++ b/owl-bot-staging/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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..cf7f5fed0 --- /dev/null +++ b/owl-bot-staging/v2/test/gapic_bigtable_v2.ts @@ -0,0 +1,636 @@ +// 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. +// +// ** 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', () => { + const client = new bigtableModule.v2.BigtableClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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()); + request.tableName = ''; + const expectedHeaderRequestParams = "table_name="; + 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)); + }); + }); + + describe('Path templates', () => { + + 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 751cf9c4e0cdb22582ee94d852ba625966934b6f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 19 Oct 2021 16:55:48 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= 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 | 10 - owl-bot-staging/admin/v2/package.json | 65 - .../admin/v2/bigtable_instance_admin.proto | 574 --- .../admin/v2/bigtable_table_admin.proto | 1003 ------ .../google/bigtable/admin/v2/common.proto | 54 - .../google/bigtable/admin/v2/instance.proto | 256 -- .../google/bigtable/admin/v2/table.proto | 405 --- ...table_instance_admin.create_app_profile.js | 72 - .../bigtable_instance_admin.create_cluster.js | 69 - ...bigtable_instance_admin.create_instance.js | 77 - ...table_instance_admin.delete_app_profile.js | 59 - .../bigtable_instance_admin.delete_cluster.js | 54 - ...bigtable_instance_admin.delete_instance.js | 54 - ...bigtable_instance_admin.get_app_profile.js | 54 - .../v2/bigtable_instance_admin.get_cluster.js | 54 - .../bigtable_instance_admin.get_iam_policy.js | 59 - .../bigtable_instance_admin.get_instance.js | 54 - ...gtable_instance_admin.list_app_profiles.js | 73 - .../bigtable_instance_admin.list_clusters.js | 60 - .../bigtable_instance_admin.list_instances.js | 58 - ..._instance_admin.partial_update_instance.js | 60 - .../bigtable_instance_admin.set_iam_policy.js | 62 - ...ble_instance_admin.test_iam_permissions.js | 62 - ...table_instance_admin.update_app_profile.js | 64 - .../bigtable_instance_admin.update_cluster.js | 85 - ...bigtable_instance_admin.update_instance.js | 90 - .../bigtable_table_admin.check_consistency.js | 60 - .../v2/bigtable_table_admin.create_backup.js | 71 - .../v2/bigtable_table_admin.create_table.js | 83 - ..._table_admin.create_table_from_snapshot.js | 69 - .../v2/bigtable_table_admin.delete_backup.js | 55 - .../bigtable_table_admin.delete_snapshot.js | 55 - .../v2/bigtable_table_admin.delete_table.js | 55 - .../v2/bigtable_table_admin.drop_row_range.js | 64 - ..._table_admin.generate_consistency_token.js | 55 - .../v2/bigtable_table_admin.get_backup.js | 55 - .../v2/bigtable_table_admin.get_iam_policy.js | 59 - .../v2/bigtable_table_admin.get_snapshot.js | 55 - .../v2/bigtable_table_admin.get_table.js | 60 - .../v2/bigtable_table_admin.list_backups.js | 121 - .../v2/bigtable_table_admin.list_snapshots.js | 68 - .../v2/bigtable_table_admin.list_tables.js | 75 - ...able_table_admin.modify_column_families.js | 63 - .../v2/bigtable_table_admin.restore_table.js | 69 - .../v2/bigtable_table_admin.set_iam_policy.js | 62 - .../v2/bigtable_table_admin.snapshot_table.js | 82 - ...gtable_table_admin.test_iam_permissions.js | 62 - .../v2/bigtable_table_admin.update_backup.js | 65 - owl-bot-staging/admin/v2/src/index.ts | 27 - .../src/v2/bigtable_instance_admin_client.ts | 2465 ------------- ...bigtable_instance_admin_client_config.json | 130 - .../bigtable_instance_admin_proto_list.json | 7 - .../v2/src/v2/bigtable_table_admin_client.ts | 3106 ----------------- .../bigtable_table_admin_client_config.json | 143 - .../v2/bigtable_table_admin_proto_list.json | 7 - .../admin/v2/src/v2/gapic_metadata.json | 463 --- 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 | 2543 -------------- .../v2/test/gapic_bigtable_table_admin_v2.ts | 2978 ---------------- 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 | 10 - owl-bot-staging/v2/package.json | 64 - .../protos/google/bigtable/v2/bigtable.proto | 427 --- .../v2/protos/google/bigtable/v2/data.proto | 536 --- .../v2/bigtable.check_and_mutate_row.js | 89 - .../generated/v2/bigtable.mutate_row.js | 72 - .../generated/v2/bigtable.mutate_rows.js | 69 - .../v2/bigtable.read_modify_write_row.js | 73 - .../generated/v2/bigtable.read_rows.js | 76 - .../generated/v2/bigtable.sample_row_keys.js | 62 - owl-bot-staging/v2/src/index.ts | 25 - owl-bot-staging/v2/src/v2/bigtable_client.ts | 780 ----- .../v2/src/v2/bigtable_client_config.json | 65 - .../v2/src/v2/bigtable_proto_list.json | 4 - owl-bot-staging/v2/src/v2/gapic_metadata.json | 68 - 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 | 636 ---- owl-bot-staging/v2/tsconfig.json | 19 - owl-bot-staging/v2/webpack.config.js | 64 - .../google/bigtable/admin/v2/instance.proto | 7 + protos/protos.d.ts | 6 + protos/protos.js | 27 + protos/protos.json | 7 + ...bigtable_instance_admin.update_instance.js | 9 +- src/v2/bigtable_instance_admin_client.ts | 4 + 106 files changed, 59 insertions(+), 20674 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_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/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.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/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 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 1a3b4732d..000000000 --- a/owl-bot-staging/admin/v2/.jsdoc.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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 2021 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 50bc7f792..000000000 --- a/owl-bot-staging/admin/v2/.mocharc.js +++ /dev/null @@ -1,33 +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. -// -// ** 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 84f4713a0..000000000 --- a/owl-bot-staging/admin/v2/.prettierrc.js +++ /dev/null @@ -1,22 +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. -// -// ** 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 29a223b6d..000000000 --- a/owl-bot-staging/admin/v2/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/admin/v2/package.json b/owl-bot-staging/admin/v2/package.json deleted file mode 100644 index 03ce0fce6..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.19.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^9.0.2", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "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 ca3aaed7a..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/bigtable_instance_admin.proto +++ /dev/null @@ -1,574 +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/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. - 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. - 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. - 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" - }; - } - - // 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"; - } -} - -// 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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; -} - -// 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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 { - -} 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 ff2076c50..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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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 17c69d469..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/common.proto +++ /dev/null @@ -1,54 +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/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 = "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 ed811ef27..000000000 --- a/owl-bot-staging/admin/v2/protos/google/bigtable/admin/v2/instance.proto +++ /dev/null @@ -1,256 +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/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: "bigtable.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]; -} - -// 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: "bigtable.googleapis.com/Cluster" - pattern: "projects/{project}/instances/{instance}/clusters/{cluster}" - }; - - // 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]; - - // Required. The number of nodes allocated to this cluster. More nodes enable - // higher throughput and more consistent performance. - int32 serve_nodes = 4 [(google.api.field_behavior) = REQUIRED]; - - // (`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: "bigtable.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; - } -} 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 a5578225e..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: "bigtable.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: "bigtable.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: "bigtable.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 d248861c5..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_app_profile.js +++ /dev/null @@ -1,72 +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. - - -'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 createAppProfile() { - // Construct request - const request = { - parent, - appProfileId, - appProfile, - }; - - // Run request - const response = await adminClient.createAppProfile(request); - console.log(response); - } - - createAppProfile(); - // [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 e2e9dbf81..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_cluster.js +++ /dev/null @@ -1,69 +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. - - -'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 createCluster() { - // Construct request - const request = { - parent, - clusterId, - cluster, - }; - - // Run request - const [operation] = await adminClient.createCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - createCluster(); - // [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 bcb432bdc..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.create_instance.js +++ /dev/null @@ -1,77 +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. - - -'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 createInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - clusters, - }; - - // Run request - const [operation] = await adminClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - createInstance(); - // [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 ba375c0ae..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_app_profile.js +++ /dev/null @@ -1,59 +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. - - -'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 deleteAppProfile() { - // Construct request - const request = { - name, - ignoreWarnings, - }; - - // Run request - const response = await adminClient.deleteAppProfile(request); - console.log(response); - } - - deleteAppProfile(); - // [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 ce6912fa8..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_cluster.js +++ /dev/null @@ -1,54 +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. - - -'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 deleteCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteCluster(request); - console.log(response); - } - - deleteCluster(); - // [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 fd3350ce0..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.delete_instance.js +++ /dev/null @@ -1,54 +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. - - -'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 deleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteInstance(request); - console.log(response); - } - - deleteInstance(); - // [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 735c02e6c..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_app_profile.js +++ /dev/null @@ -1,54 +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. - - -'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 getAppProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getAppProfile(request); - console.log(response); - } - - getAppProfile(); - // [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 c1bfa4066..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_cluster.js +++ /dev/null @@ -1,54 +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. - - -'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 getCluster() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getCluster(request); - console.log(response); - } - - getCluster(); - // [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 2290a91bb..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_iam_policy.js +++ /dev/null @@ -1,59 +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. - - -'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 getIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await adminClient.getIamPolicy(request); - console.log(response); - } - - getIamPolicy(); - // [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 4b3e12346..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.get_instance.js +++ /dev/null @@ -1,54 +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. - - -'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 getInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getInstance(request); - console.log(response); - } - - getInstance(); - // [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 3db250168..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_app_profiles.js +++ /dev/null @@ -1,73 +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. - - -'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 listAppProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listAppProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - listAppProfiles(); - // [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 7c2fd4e5d..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_clusters.js +++ /dev/null @@ -1,60 +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. - - -'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 listClusters() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await adminClient.listClusters(request); - console.log(response); - } - - listClusters(); - // [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 215d2e87b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.list_instances.js +++ /dev/null @@ -1,58 +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. - - -'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 listInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await adminClient.listInstances(request); - console.log(response); - } - - listInstances(); - // [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_instance.js b/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js deleted file mode 100644 index f2e424559..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.partial_update_instance.js +++ /dev/null @@ -1,60 +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. - - -'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 partialUpdateInstance() { - // Construct request - const request = { - instance, - updateMask, - }; - - // Run request - const [operation] = await adminClient.partialUpdateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - partialUpdateInstance(); - // [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 12d21d6f0..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.set_iam_policy.js +++ /dev/null @@ -1,62 +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. - - -'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 setIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await adminClient.setIamPolicy(request); - console.log(response); - } - - setIamPolicy(); - // [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 a3c0984dd..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.test_iam_permissions.js +++ /dev/null @@ -1,62 +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. - - -'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 testIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await adminClient.testIamPermissions(request); - console.log(response); - } - - testIamPermissions(); - // [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 248dbd756..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_app_profile.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 -// -// 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. - - -'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 updateAppProfile() { - // Construct request - const request = { - appProfile, - updateMask, - }; - - // Run request - const [operation] = await adminClient.updateAppProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - updateAppProfile(); - // [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 33603c42e..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_cluster.js +++ /dev/null @@ -1,85 +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. - - -'use strict'; - -function main(name, state, serveNodes, 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 = '' - /** - * Required. The number of nodes allocated to this cluster. More nodes enable - * higher throughput and more consistent performance. - */ - // const serveNodes = 1234 - /** - * (`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 updateCluster() { - // Construct request - const request = { - name, - state, - serveNodes, - encryptionConfig, - }; - - // Run request - const [operation] = await adminClient.updateCluster(request); - const [response] = await operation.promise(); - console.log(response); - } - - updateCluster(); - // [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 4463c8d6b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_instance_admin.update_instance.js +++ /dev/null @@ -1,90 +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. - - -'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 updateInstance() { - // Construct request - const request = { - name, - displayName, - createTime, - }; - - // Run request - const response = await adminClient.updateInstance(request); - console.log(response); - } - - updateInstance(); - // [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 a95a2d7f0..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.check_consistency.js +++ /dev/null @@ -1,60 +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. - - -'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 checkConsistency() { - // Construct request - const request = { - name, - consistencyToken, - }; - - // Run request - const response = await adminClient.checkConsistency(request); - console.log(response); - } - - checkConsistency(); - // [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 3e325a59e..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_backup.js +++ /dev/null @@ -1,71 +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. - - -'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 createBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await adminClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - createBackup(); - // [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 86c9a382a..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table.js +++ /dev/null @@ -1,83 +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. - - -'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 createTable() { - // Construct request - const request = { - parent, - tableId, - table, - }; - - // Run request - const response = await adminClient.createTable(request); - console.log(response); - } - - createTable(); - // [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 d75234081..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.create_table_from_snapshot.js +++ /dev/null @@ -1,69 +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. - - -'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 createTableFromSnapshot() { - // Construct request - const request = { - parent, - tableId, - sourceSnapshot, - }; - - // Run request - const [operation] = await adminClient.createTableFromSnapshot(request); - const [response] = await operation.promise(); - console.log(response); - } - - createTableFromSnapshot(); - // [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 f9e5f60f5..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_backup.js +++ /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. - - -'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 deleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteBackup(request); - console.log(response); - } - - deleteBackup(); - // [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 76fd831b8..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_snapshot.js +++ /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. - - -'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 deleteSnapshot() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteSnapshot(request); - console.log(response); - } - - deleteSnapshot(); - // [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 ff9f526a1..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.delete_table.js +++ /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. - - -'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 deleteTable() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.deleteTable(request); - console.log(response); - } - - deleteTable(); - // [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 3cf2d82d3..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.drop_row_range.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 -// -// 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. - - -'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 dropRowRange() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.dropRowRange(request); - console.log(response); - } - - dropRowRange(); - // [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 8b344c122..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.generate_consistency_token.js +++ /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. - - -'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 generateConsistencyToken() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.generateConsistencyToken(request); - console.log(response); - } - - generateConsistencyToken(); - // [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 58eb2fdca..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_backup.js +++ /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. - - -'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 getBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getBackup(request); - console.log(response); - } - - getBackup(); - // [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 f413fe2e3..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_iam_policy.js +++ /dev/null @@ -1,59 +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. - - -'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 getIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await adminClient.getIamPolicy(request); - console.log(response); - } - - getIamPolicy(); - // [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 be11488fa..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_snapshot.js +++ /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. - - -'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 getSnapshot() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getSnapshot(request); - console.log(response); - } - - getSnapshot(); - // [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 a3b8f961b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.get_table.js +++ /dev/null @@ -1,60 +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. - - -'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 getTable() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await adminClient.getTable(request); - console.log(response); - } - - getTable(); - // [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 9129bcb71..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_backups.js +++ /dev/null @@ -1,121 +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. - - -'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 listBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - listBackups(); - // [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 a9cc84086..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_snapshots.js +++ /dev/null @@ -1,68 +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. - - -'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 listSnapshots() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listSnapshotsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - listSnapshots(); - // [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 9dac9771f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.list_tables.js +++ /dev/null @@ -1,75 +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. - - -'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 listTables() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await adminClient.listTablesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - listTables(); - // [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 d5c051f5b..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.modify_column_families.js +++ /dev/null @@ -1,63 +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. - - -'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 modifyColumnFamilies() { - // Construct request - const request = { - name, - modifications, - }; - - // Run request - const response = await adminClient.modifyColumnFamilies(request); - console.log(response); - } - - modifyColumnFamilies(); - // [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 070673522..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.restore_table.js +++ /dev/null @@ -1,69 +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. - - -'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 restoreTable() { - // Construct request - const request = { - parent, - tableId, - }; - - // Run request - const [operation] = await adminClient.restoreTable(request); - const [response] = await operation.promise(); - console.log(response); - } - - restoreTable(); - // [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 e5f2ceba5..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.set_iam_policy.js +++ /dev/null @@ -1,62 +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. - - -'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 setIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await adminClient.setIamPolicy(request); - console.log(response); - } - - setIamPolicy(); - // [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 bfe7ca864..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.snapshot_table.js +++ /dev/null @@ -1,82 +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. - - -'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 snapshotTable() { - // Construct request - const request = { - name, - cluster, - snapshotId, - }; - - // Run request - const [operation] = await adminClient.snapshotTable(request); - const [response] = await operation.promise(); - console.log(response); - } - - snapshotTable(); - // [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 dba7d267f..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.test_iam_permissions.js +++ /dev/null @@ -1,62 +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. - - -'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 testIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await adminClient.testIamPermissions(request); - console.log(response); - } - - testIamPermissions(); - // [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 dcf247450..000000000 --- a/owl-bot-staging/admin/v2/samples/generated/v2/bigtable_table_admin.update_backup.js +++ /dev/null @@ -1,65 +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. - - -'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 updateBackup() { - // Construct request - const request = { - backup, - updateMask, - }; - - // Run request - const response = await adminClient.updateBackup(request); - console.log(response); - } - - updateBackup(); - // [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/src/index.ts b/owl-bot-staging/admin/v2/src/index.ts deleted file mode 100644 index 73054c954..000000000 --- a/owl-bot-staging/admin/v2/src/index.ts +++ /dev/null @@ -1,27 +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. -// -// ** 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 97d86954f..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client.ts +++ /dev/null @@ -1,2465 +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. -// -// ** 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}' - ), - 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') - }; - - 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 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)), - 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', 'deleteCluster', 'createAppProfile', 'getAppProfile', 'listAppProfiles', 'updateAppProfile', 'deleteAppProfile', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; - 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 -- - // ------------------- - 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; -/** - * 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 - * const [response] = await client.getInstance(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.listInstances(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.updateInstance(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteInstance(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getCluster(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.listClusters(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteCluster(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.createAppProfile(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getAppProfile(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteAppProfile(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getIamPolicy(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.setIamPolicy(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.testIamPermissions(request); - */ - 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); - } - - 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; -/** - * Create an instance within a project. - * - * @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 - * const [operation] = await client.createInstance(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkCreateInstanceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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 - * const [operation] = await client.partialUpdateInstance(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkPartialUpdateInstanceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * Creates a cluster 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 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 - * const [operation] = await client.createCluster(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkCreateClusterProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * Updates a cluster within an instance. - * - * @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 - * Required. The number of nodes allocated to this cluster. More nodes enable - * higher throughput and more consistent performance. - * @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 - * const [operation] = await client.updateCluster(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkUpdateClusterProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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 - * const [operation] = await client.updateAppProfile(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkUpdateAppProfileProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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, - 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 - * const iterable = client.listAppProfilesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - 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 || '', - }); - options = options || {}; - 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; - } - // -------------------- - // -- 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 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 { - this.initialize(); - if (!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 2f6b84535..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_instance_admin_client_config.json +++ /dev/null @@ -1,130 +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" - }, - "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" - } - } - } - } -} 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 d26111919..000000000 --- a/owl-bot-staging/admin/v2/src/v2/bigtable_table_admin_client.ts +++ /dev/null @@ -1,3106 +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. -// -// ** 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}' - ), - 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 -- - // ------------------- - 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; -/** - * 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 - * const [response] = await client.createTable(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getTable(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteTable(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.modifyColumnFamilies(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.dropRowRange(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.generateConsistencyToken(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.checkConsistency(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getSnapshot(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteSnapshot(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getBackup(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.updateBackup(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.deleteBackup(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.getIamPolicy(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.setIamPolicy(request); - */ - 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); - } - 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; -/** - * 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 - * const [response] = await client.testIamPermissions(request); - */ - 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); - } - - 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; -/** - * 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 - * const [operation] = await client.createTableFromSnapshot(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkCreateTableFromSnapshotProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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 - * const [operation] = await client.snapshotTable(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkSnapshotTableProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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 - * const [operation] = await client.createBackup(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkCreateBackupProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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 - * const [operation] = await client.restoreTable(request); - * const [response] = await operation.promise(); - */ - 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 - * const decodedOperation = await checkRestoreTableProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - */ - 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; - } - 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; -/** - * 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, - 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 - * const iterable = client.listTablesAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - 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 || '', - }); - options = options || {}; - 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; - } - 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; -/** - * 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, - 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 - * const iterable = client.listSnapshotsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - 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 || '', - }); - options = options || {}; - 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; - } - 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; -/** - * 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, - 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 - * const iterable = client.listBackupsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - 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 || '', - }); - options = options || {}; - 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 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 { - this.initialize(); - if (!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 7c0177a6c..000000000 --- a/owl-bot-staging/admin/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,463 +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" - ] - }, - "UpdateAppProfile": { - "methods": [ - "updateAppProfile" - ] - }, - "ListAppProfiles": { - "methods": [ - "listAppProfiles", - "listAppProfilesStream", - "listAppProfilesAsync" - ] - } - } - }, - "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" - ] - }, - "UpdateAppProfile": { - "methods": [ - "updateAppProfile" - ] - }, - "ListAppProfiles": { - "methods": [ - "listAppProfiles", - "listAppProfilesStream", - "listAppProfilesAsync" - ] - } - } - } - } - }, - "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 b1c8a1db1..000000000 --- a/owl-bot-staging/admin/v2/src/v2/index.ts +++ /dev/null @@ -1,20 +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. -// -// ** 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 57e93d843..000000000 --- a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +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. -// -// ** 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 6c7330447..000000000 --- a/owl-bot-staging/admin/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +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. -// -// ** 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 1f850b522..000000000 --- a/owl-bot-staging/admin/v2/system-test/install.ts +++ /dev/null @@ -1,49 +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. -// -// ** 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 d1e9e8086..000000000 --- a/owl-bot-staging/admin/v2/test/gapic_bigtable_instance_admin_v2.ts +++ /dev/null @@ -1,2543 +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. -// -// ** 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', () => { - const client = new bigtableinstanceadminModule.v2.BigtableInstanceAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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('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('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('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 1d6e155d7..000000000 --- a/owl-bot-staging/admin/v2/test/gapic_bigtable_table_admin_v2.ts +++ /dev/null @@ -1,2978 +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. -// -// ** 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', () => { - const client = new bigtabletableadminModule.v2.BigtableTableAdminClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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)); - }); - }); - - 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('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 1a3b4732d..000000000 --- a/owl-bot-staging/v2/.jsdoc.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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 2021 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 50bc7f792..000000000 --- a/owl-bot-staging/v2/.mocharc.js +++ /dev/null @@ -1,33 +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. -// -// ** 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 84f4713a0..000000000 --- a/owl-bot-staging/v2/.prettierrc.js +++ /dev/null @@ -1,22 +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. -// -// ** 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 29a223b6d..000000000 --- a/owl-bot-staging/v2/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v2/package.json b/owl-bot-staging/v2/package.json deleted file mode 100644 index 51cb1cceb..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.19.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^9.0.2", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "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 32aaba21d..000000000 --- a/owl-bot-staging/v2/protos/google/bigtable/v2/bigtable.proto +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.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/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: "bigtable.googleapis.com/Table" - pattern: "projects/{project}/instances/{instance}/tables/{table}" -}; - -// 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.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.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.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.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.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"; - } - - // 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.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: "bigtable.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. 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 terminate 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: "bigtable.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: "bigtable.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: "bigtable.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: "bigtable.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 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: "bigtable.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 2cc916454..000000000 --- a/owl-bot-staging/v2/protos/google/bigtable/v2/data.proto +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.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 4096 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 64ec1054a..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.check_and_mutate_row.js +++ /dev/null @@ -1,89 +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. - - -'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 checkAndMutateRow() { - // Construct request - const request = { - tableName, - rowKey, - }; - - // Run request - const response = await bigtableClient.checkAndMutateRow(request); - console.log(response); - } - - checkAndMutateRow(); - // [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 a5977562e..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_row.js +++ /dev/null @@ -1,72 +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. - - -'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 mutateRow() { - // Construct request - const request = { - tableName, - rowKey, - mutations, - }; - - // Run request - const response = await bigtableClient.mutateRow(request); - console.log(response); - } - - mutateRow(); - // [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 c397cae00..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.mutate_rows.js +++ /dev/null @@ -1,69 +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. - - -'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 mutateRows() { - // 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 */ }); - } - - mutateRows(); - // [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.read_modify_write_row.js b/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js deleted file mode 100644 index e504278dd..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_modify_write_row.js +++ /dev/null @@ -1,73 +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. - - -'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 readModifyWriteRow() { - // Construct request - const request = { - tableName, - rowKey, - rules, - }; - - // Run request - const response = await bigtableClient.readModifyWriteRow(request); - console.log(response); - } - - readModifyWriteRow(); - // [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 ce5ec5cd6..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.read_rows.js +++ /dev/null @@ -1,76 +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. - - -'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. 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 terminate 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 readRows() { - // 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 */ }); - } - - readRows(); - // [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 37a8e1408..000000000 --- a/owl-bot-staging/v2/samples/generated/v2/bigtable.sample_row_keys.js +++ /dev/null @@ -1,62 +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. - - -'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 sampleRowKeys() { - // 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 */ }); - } - - sampleRowKeys(); - // [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/src/index.ts b/owl-bot-staging/v2/src/index.ts deleted file mode 100644 index 9920fa2b4..000000000 --- a/owl-bot-staging/v2/src/index.ts +++ /dev/null @@ -1,25 +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. -// -// ** 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 3231d9dc4..000000000 --- a/owl-bot-staging/v2/src/v2/bigtable_client.ts +++ /dev/null @@ -1,780 +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. -// -// ** 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} from 'google-gax'; - -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 = { - 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', 'readModifyWriteRow']; - for (const methodName of bigtableStubMethods) { - const callPromise = this.bigtableStub.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.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 -- - // ------------------- - 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; -/** - * 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. - * @example - * const [response] = await client.mutateRow(request); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - this.initialize(); - return this.innerApiCalls.mutateRow(request, options, callback); - } - 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; -/** - * 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. - * @example - * const [response] = await client.checkAndMutateRow(request); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - this.initialize(); - return this.innerApiCalls.checkAndMutateRow(request, options, callback); - } - 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; -/** - * 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. - * @example - * const [response] = await client.readModifyWriteRow(request); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - 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. 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 terminate 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. - * @example - * const stream = client.readRows(request); - * stream.on('data', (response) => { ... }); - * stream.on('end', () => { ... }); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - 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. - * @example - * const stream = client.sampleRowKeys(request); - * stream.on('data', (response) => { ... }); - * stream.on('end', () => { ... }); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - 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. - * @example - * const stream = client.mutateRows(request); - * stream.on('data', (response) => { ... }); - * stream.on('end', () => { ... }); - */ - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'table_name': request.tableName || '', - }); - this.initialize(); - return this.innerApiCalls.mutateRows(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * 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 { - this.initialize(); - if (!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 2c2765aa6..000000000 --- a/owl-bot-staging/v2/src/v2/bigtable_client_config.json +++ /dev/null @@ -1,65 +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": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "SampleRowKeys": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "MutateRow": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "MutateRows": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "CheckAndMutateRow": { - "timeout_millis": 20000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - }, - "ReadModifyWriteRow": { - "timeout_millis": 20000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "5af39a0f6db447f61c4f695240caeccb74f78362" - } - } - } - } -} 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 6e578d2c9..000000000 --- a/owl-bot-staging/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,68 +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" - ] - }, - "ReadModifyWriteRow": { - "methods": [ - "readModifyWriteRow" - ] - }, - "ReadRows": { - "methods": [ - "readRows" - ] - }, - "SampleRowKeys": { - "methods": [ - "sampleRowKeys" - ] - }, - "MutateRows": { - "methods": [ - "mutateRows" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "BigtableClient", - "rpcs": { - "MutateRow": { - "methods": [ - "mutateRow" - ] - }, - "CheckAndMutateRow": { - "methods": [ - "checkAndMutateRow" - ] - }, - "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 03c68bbff..000000000 --- a/owl-bot-staging/v2/src/v2/index.ts +++ /dev/null @@ -1,19 +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. -// -// ** 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 d09f0fc9d..000000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +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. -// -// ** 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 a9734010c..000000000 --- a/owl-bot-staging/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +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. -// -// ** 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 1f850b522..000000000 --- a/owl-bot-staging/v2/system-test/install.ts +++ /dev/null @@ -1,49 +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. -// -// ** 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 cf7f5fed0..000000000 --- a/owl-bot-staging/v2/test/gapic_bigtable_v2.ts +++ /dev/null @@ -1,636 +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. -// -// ** 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', () => { - const client = new bigtableModule.v2.BigtableClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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()); - request.tableName = ''; - const expectedHeaderRequestParams = "table_name="; - 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)); - }); - }); - - describe('Path templates', () => { - - 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/instance.proto b/protos/google/bigtable/admin/v2/instance.proto index aecf7ee53..ed811ef27 100644 --- a/protos/google/bigtable/admin/v2/instance.proto +++ b/protos/google/bigtable/admin/v2/instance.proto @@ -19,6 +19,8 @@ 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"; @@ -105,6 +107,11 @@ message Instance { // * 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]; } // A resizable group of nodes in a particular cloud location, capable diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 5451a5a3d..aef4d9122 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -2620,6 +2620,9 @@ export namespace google { /** Instance labels */ labels?: ({ [k: string]: string }|null); + + /** Instance createTime */ + createTime?: (google.protobuf.ITimestamp|null); } /** Represents an Instance. */ @@ -2646,6 +2649,9 @@ export namespace google { /** Instance labels. */ public labels: { [k: string]: string }; + /** Instance createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 4a5590a65..ec7b0bf2b 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -5754,6 +5754,7 @@ * @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 */ /** @@ -5812,6 +5813,14 @@ */ 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 @@ -5847,6 +5856,8 @@ 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; }; @@ -5915,6 +5926,9 @@ } message.labels[key] = value; break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -5982,6 +5996,11 @@ 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; }; @@ -6036,6 +6055,11 @@ 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; }; @@ -6059,6 +6083,7 @@ object.displayName = ""; object.state = options.enums === String ? "STATE_NOT_KNOWN" : 0; object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.createTime = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -6074,6 +6099,8 @@ for (var j = 0; j < keys2.length; ++j) object.labels[keys2[j]] = message.labels[keys2[j]]; } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); return object; }; diff --git a/protos/protos.json b/protos/protos.json index a30ec916c..ff000c002 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -835,6 +835,13 @@ "keyType": "string", "type": "string", "id": 5 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { diff --git a/samples/generated/v2/bigtable_instance_admin.update_instance.js b/samples/generated/v2/bigtable_instance_admin.update_instance.js index a7d792530..565df41c3 100644 --- a/samples/generated/v2/bigtable_instance_admin.update_instance.js +++ b/samples/generated/v2/bigtable_instance_admin.update_instance.js @@ -14,7 +14,7 @@ 'use strict'; -function main(name, displayName) { +function main(name, displayName, createTime) { // [START bigtableadmin_v2_generated_BigtableInstanceAdmin_UpdateInstance_async] /** * TODO(developer): Uncomment these variables before running the sample. @@ -52,6 +52,12 @@ function main(name, displayName) { * * 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; @@ -64,6 +70,7 @@ function main(name, displayName) { const request = { name, displayName, + createTime, }; // Run request diff --git a/src/v2/bigtable_instance_admin_client.ts b/src/v2/bigtable_instance_admin_client.ts index a57583250..1f3770c56 100644 --- a/src/v2/bigtable_instance_admin_client.ts +++ b/src/v2/bigtable_instance_admin_client.ts @@ -670,6 +670,10 @@ export class BigtableInstanceAdminClient { * 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.